我正在开发一个应用程序,我正在使用Vue 2javascript框架,在v-for循环中我需要将循环的计数器绑定到v-model元素的名称,这是我的代码:
<div v-for="n in total" class="form-group">
<input type="hidden" id="input_id" :name="'input_name_id[' + n + ']'" v-model="form.parent_id_n" />
</div>
Run Code Online (Sandbox Code Playgroud)
我需要n成为循环的计数器,例如它应该是第一个元素:
<div class="form-group">
<input type="hidden" id="input_id" :name="'input_name_id[1]" v-model="form.parent_id_1" />
</div>
Run Code Online (Sandbox Code Playgroud)
在name attribute结合的作品,但我不知道如何得到v-model工作呢?
我们正在开发一个应用程序,我们正在使用twiiter bootstrap 3我们创建了一个带导航丸的导航栏
<ul class="nav nav-pills head-menu">
<input type="hidden" id="selected_menu_item" value="=$selectedMenuId; ?>" />
<li>
<a href="#" id="welcome">
Welcome text ...
</a>
</li>
<li><a href="#" id="kitchen">Kitchen</a></li>
<li><a href="#" id="programma" > Programma</a></li>
<li><a href="#" id="foodart" >foodart text</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
任何具有自举经验的人都可以帮助我们,如果我们可以使这个导航丸可以折叠和响应大小减少就像我们可以轻松使用导航栏一样吗?
提前致谢
html responsive-design twitter-bootstrap twitter-bootstrap-3
我正在开发一个单页应用程序,在AngularJS的帮助下,我是新手,我之前问了同样的问题,但没有得到任何答案,所以我正在重述我的问题并再次问它
问题:我需要做的是让我的Web应用程序启用脱机工作,为此目的,呈现为视图的html文件(例如home.html)应该以某种方式包含在index.html中,所以当点击时一些链接应该不需要访问html文件而不是同一页面的一部分,例如潜水将被渲染,我应该对项目进行哪些修改才能完成
目前我制作了不同的html文件并在渲染视图时将它们用作模板,app的结构如下:
- index.html
- pages
----- home.html
----- profile.html
Run Code Online (Sandbox Code Playgroud)
这是配置路由和控制器和视图的代码
var formApp = angular.module('formApp', ['ngRoute']);
formApp.config(function($routeProvider) {
$routeProvider
.when('/', {
templateUrl : 'main',
controller : 'mainController'
})
.when('/profile', {
templateUrl : 'profile',
controller : 'profileController'
})
});
Run Code Online (Sandbox Code Playgroud)
而且我的main.html文件就是这样的:
<div class="jumbotron text-center">
<h1>Main Page</h1>
<p>{{ message }}</p>
</div>
Run Code Online (Sandbox Code Playgroud)
我在index.html的某个地方
<div ng-view>
{{ message }}
</div>
Run Code Online (Sandbox Code Playgroud)
代码工作正常,此刻一切都很好
我正在为Laravel 5开发一个包,现在我需要从依赖注入中受益,以获得更具可伸缩性和可靠性的应用程序,我不知道哪种方法最好采用,为什么,这是我的代码和我需要注入Lang类依赖项
class MyController extends \App\Http\Controllers\Controller
{
public $text;
public $lang;
public function __construct()
{
// Some codes here
}
public function myFunction(){
$this->text = \Lang::get('package::all.text1');
}
}
Run Code Online (Sandbox Code Playgroud)
在这个链接http://laravel.com/docs/4.2/ioc建议2方法,Basic Usage并Automatic Resolution根据我的链接采取第一种方法我需要添加的理解
App::bind('lang', function($app)
{
return new \Lang();
});
Run Code Online (Sandbox Code Playgroud)
到应用程序的寄存器部分然后在函数中我会有这样的事情:
public function myFunction()
{
$lang = \App::make('lang');
$this->text = $lang::get('package::all.text1');
}
Run Code Online (Sandbox Code Playgroud)
另一种方法是修改之constructor类的
public function __construct(Lang $lang)
{
$this->lang = $lang;
}
Run Code Online (Sandbox Code Playgroud)
然后从类中实例化对象
$myController = App::make('MyController');
Run Code Online (Sandbox Code Playgroud)
哪种方式更好的方式,考虑到这class是一个Controller,它将在routes …
我正在使用Play Framework 2.2和Java开发应用程序我已经实现了身份验证模块,就像下面的教程 http://www.playframework.com/documentation/2.1.0/JavaGuide4
简而言之,实施了一个安全类
public class Secured extends Security.Authenticator{
@Override
public String getUsername(Context ctx) {
return ctx.session().get("email");
}
@Override
public Result onUnauthorized(Context ctx) {
return redirect(routes.Users.login());
}
}
Run Code Online (Sandbox Code Playgroud)
然后在控制器中我将这一行添加到控制器的方法中
@Security.Authenticated(Secured.class)
public static Result methodOfController(){
//some codes here
return ok( someView.render());
}
Run Code Online (Sandbox Code Playgroud)
正如您所看到的那样,它只是身份验证而非授权,例如,它会检查用户是否已登录,但从不检查这是否是管理员的电子邮件
我的问题是:我应该如何为这些类添加访问权限,或者如何为此身份验证添加授权
请给我一个描述性答案,说明我应该对这个类,控制器甚至项目的其他部分(可能是模型)进行哪些修改以获得适当的授权
请不要提供网站或网络日志的链接,除非他们专注于一个非常类似的问题
authentication authorization playframework playframework-2.2
我正在为Laravel 5开发一个包,但是如果用户更改了应用程序的默认命名空间,则package by命令php artisan app:name Test将无法正常工作.包需要知道App的命名空间才能正常工作.
根据我的理解,Laravel 5不会在其任何核心类中提供应用程序的命名空间
所以我决定从composer.json文件中获取这个命名空间
"psr-4": {
"AppNamespace\\": "app/"
}
Run Code Online (Sandbox Code Playgroud)
或者要求用户在一种配置文件中提供应用程序的命名空间.
问题:请告诉我,如果我对Laravel的推定没有提供这是正确的,如果它是正确的,请告诉我哪种方式是最好的方式来获得这个namespace或者你有什么更好的建议?
我在Windows上用Python Django开发一个应用程序我试图在我的一个类中添加一个图像上传字段,但是我得到错误,我必须提到我需要给一个相对路径到settings.py所以我可以轻松将我的代码迁移到另一个平台
我应该如何填写settings.py中的以下变量以使它们工作
MEDIA_ROOT = #root to my project
MEDIA_URL = #url
Run Code Online (Sandbox Code Playgroud)
而在models.py我有
class ProdcutImage(models.Model):
product = models.ForeignKey(Product)
image = models.ImageField(upload_to = "/products" )
Run Code Online (Sandbox Code Playgroud)
我需要将图像上传到此文件夹中:
"MY_PROJECT_ADDRESS/static/images/products"
Run Code Online (Sandbox Code Playgroud)
您的帮助将不胜感激
我试图在vagrant和puphpet的帮助下建立一个开发环境我通过puphpet网站设置了一些设置然后下载文件当我运行vagrant一切顺利我可以通过机器ssh但是没有安装mysql这是config.yaml配置中的设置
mysql:
install: '1'
root_password: ''
adminer: '1'
databases:
PMgPjSFyp8dY:
grant:
- ALL
name: dbname
host: localhost
user: dbuser
password: '123'
sql_file: ''
Run Code Online (Sandbox Code Playgroud)

我的问题是:为什么没有安装mysql它依赖于任何其他配置?或者我的配置文件有什么问题?
谢谢你提前帮助
我已经为laravel 4.2开发了一个软件包,当你晚上已经注意到laravel 5.0刚刚发布时,我的软件包无法安装在新的laravel项目上
我的包的composer文件如下所示:
"require": {
"php": ">=5.4.0",
"illuminate/support": "4.2.*",
"zofe/rapyd" : "1.3.*"
},
Run Code Online (Sandbox Code Playgroud)
问题:
我应该对项目进行哪些更改以使其与Laravel 5项目兼容?而且我的软件包需要这个软件包https://github.com/zofe/rapyd-laravel尚未为Laravel5发布,是否会阻止我的软件包正确安装?
我正在为Laravel 5开发一个包,我决定在使用Laravel的Core类时从我的包中依赖注入中获益,但是在阅读了更多内容之后并且也提出了这个问题 Laravel 5包中的依赖注入的最佳方法
现在我提出这样的想法:如果我们使用Facades这么多并且调用静态方法,比如FaceadeName:nameOfMethodContainer实际上为我们创建了一个对象并调用它的方法,那么在某种程度上使用依赖注入laravel用于类也可以通过Facade获得几乎没用.
例如,有这个类:
class MyController extends \App\Http\Controllers\Controller
{
public $text;
public $lang;
public function __construct()
{
// Some codes here
}
public function myFunction(){
$this->text = \Lang::get('package::all.text1');
}
}
Run Code Online (Sandbox Code Playgroud)
这样做:
App::bind('lang', function($app)
{
return new \Lang();
});
Run Code Online (Sandbox Code Playgroud)
然后在功能中:
public function myFunction()
{
$lang = \App::make('lang');
$this->text = $lang::get('package::all.text1');
}
Run Code Online (Sandbox Code Playgroud)
几乎没用,因为我们将一些东西绑定到已经绑定的容器
这不是一个好主意,改变myFunction到
public function myFunction(\Lang $lang){
$this->text = $lang::get('package::all.text1');
}
Run Code Online (Sandbox Code Playgroud)
同样,它可能看起来像方法注入,但它没有带来太多的优势.因此,这将是最好不要使用dependency injection用于Facades在Laravel.如果我是对的,请告诉我,如果我错了,请用正确的答案与我争辩.
我正在开发一个宁静的laravel应用程序,我需要知道在Laravel中实现路由,控制器和方法的最佳实践是什么,以支持我们restful requests,HTTP web requests我们可以轻松创建资源控制器,然后将以下行添加到routes文件在Laravel:
Route::resource('Photo', 'PhotoController');
然后在PhotoController我们只需要添加以下代码行,这些代码返回json所有照片的响应:
class PhotoController {
public function index()
{
$photos = Photo::all();
return response()->
json(['result' => $photos]);
}
}
Run Code Online (Sandbox Code Playgroud)
我们还需要一个Controller和一个method响应Web HTTP请求并返回一个网页而不是一个json响应的响应,该响应向Web用户显示所有照片
问题: 放置此方法的最佳位置在哪里和控制器是一个好的做法,将它放在同一个Controller中并返回一个视图?像下面的例子
class PhotoController{
public function getAll(){
$photos = Photo::getAll();
return view('views',['photos'=>$photos]);
}
}
Run Code Online (Sandbox Code Playgroud)
或者创建另一个Controller并在那里处理Web请求并rout在routes文件中添加一个新的例如:mysite.com\photos\all到routes文件?
或者我是否必须将此保留在另一个中,Controller或者我是否必须使用与以下示例相同的方法来确定请求是否来自Web:
public function index()
{
$photos = Photo::all();
if ( from web ){
return …Run Code Online (Sandbox Code Playgroud) 我卸载了先前版本的android,然后安装了version3.0.1,我在android studio中创建了一个新应用,但我没有修改任何代码,但是当我尝试构建项目时,出现以下错误
Error:resource style/Theme.AppCompat.Light.DarkActionBar (aka com.example.android.my:style/Theme.AppCompat.Light.DarkActionBar) not found.
C:\AndroidStudioProjects\MyAPP\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Error:(101) error: style attribute 'attr/colorPrimary (aka com.example.android.my:attr/colorPrimary)' not found.
Error:(102) error: style attribute 'attr/colorPrimaryDark (aka com.example.android.com.example.android.my:attr/colorPrimaryDark)' not found.
Error:(103) error: style attribute 'attr/colorAccent (aka com.example.android.my:attr/colorAccent)' not found.
Error:(101) style attribute 'attr/colorPrimary (aka com.example.android.my:attr/colorPrimary)' not found.
Error:(102) style attribute 'attr/colorPrimaryDark (aka com.example.android.my:attr/colorPrimaryDark)' not found.
Error:(103) style attribute 'attr/colorAccent (aka com.example.android.my:attr/colorAccent)' not found.
Error:failed linking references.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details …Run Code Online (Sandbox Code Playgroud) 我正在用Laravel 4开发一个应用程序我需要做的是:让我说我有以下路线:
Route::get('/myroute/{entity}/methodname',
);
Run Code Online (Sandbox Code Playgroud)
在其中我需要根据实体变量来决定应该调用哪个Controller和方法,例如:
'MyNameSpace\MyPackage\StudentController@methodname'
Run Code Online (Sandbox Code Playgroud)
如果
entity == Student
Run Code Online (Sandbox Code Playgroud)
并打电话给
'MyNameSpace\MyPackage\StaffController@methodname'
Run Code Online (Sandbox Code Playgroud)
如果
entity == Staff
Run Code Online (Sandbox Code Playgroud)
如何在Laravel 4中完成路由是否有可能或者我必须想出两条不同的路线呢?
Route::get('/myroute/Student/methodname') and Route::get('/myroute/Staff/methodname')
Run Code Online (Sandbox Code Playgroud) laravel ×5
laravel-5 ×5
html ×2
javascript ×2
android ×1
angularjs ×1
django ×1
django-admin ×1
laravel-4 ×1
mysql ×1
namespaces ×1
packages ×1
php ×1
puphpet ×1
python ×1
rest ×1
restful-url ×1
vagrant ×1
vuejs2 ×1