我有这个方法:
print(settings.REST_FRAMEWORK)
['DEFAULT_PERMISSION_CLASSES', 'DEFAULT_AUTHENTICATION_CLASSES', 'DEFAULT_FILTER_BACKENDS', 'DEFAULT_PAGINATION_CLASS', 'DEFAULT_RENDERER_CLASSES']
在路线中我有这个:
addCheckbox: function() {
if(this.field.value) {
this.fields.push(this.field);
this.field = { value: '' };
}
this.$http.get('/profile/checkoutAdditionalFeatures').then(function(response){
// True
data = response.data;
console.log(data);
this.$set('checkoutAdditionalFeatures', data);
}, function(response){
console.log(response);
// False
}.bind(this));
}
在控制器中我有这个:
Route::get('/profile/checkoutAdditionalFeatures', 'StandardUser\PropertiesController@checkoutAdditionalFeatures');
HTML:
public function checkoutAdditionalFeatures($additional_features){
if(!empty($additional_features)){
foreach($additional_features as $additional_feature){
$data = [
'name' => $additional_feature,
];
if (!Feature::where('name', '=', $additional_feature)->exists()) {
$additional = Feature::firstOrCreate($data);
$additional_ids[] = $additional->id;
return true;
}
return false;
}
我想要的是当用户输入一些单词并点击按钮检查控制器是否为真或假然后返回vue.js.然后我想在视图中显示该字是否为假。