在 vuetify 上使用 v-text-field 时,我可以使用 name 属性并捕获表单输入。但是,v-select 上的名称属性似乎不起作用。我目前仅在 Laravel 应用程序中使用 Vuetify 进行主题化,并且不想使用 v-model。有没有办法解决这个问题,以便我可以从 v-select 获取表单值。
<v-select name="parent_id"
:items="{{ json_encode($entries) }}"
label="Select Parent" {{ !$errors->has('parent_id') ?'': 'error' }}
hint="{{ $errors->has('parent_id') ? $errors->first('parent_id') :"" }}" persistent-hint="">
</v-select>
Run Code Online (Sandbox Code Playgroud)
为了简洁起见,我没有包含 v-text-field 选项。然而,在后端,我可以获得除所示的parent_id 之外的所有内容。
小智 0
v-select 组件有两个属性,一个用于显示,另一个用于值 item-value 、 item-text 如果我们有
items =[
{id:1,name:'hi'}
];
Run Code Online (Sandbox Code Playgroud)
我们可以用 <v-select :items="items" item-value="id" item-text="name" />
| 归档时间: |
|
| 查看次数: |
1529 次 |
| 最近记录: |