英文:
v-autocomplete lost "change event" in vuetify 3?
问题
在Vuetify 2中,v-autocomplete组件有一个名为change event的事件。示例:
<v-autocomplete
label="Choose stock"
v-model="selected_stock"
:items="current_stocks"
:change="stockSelected"
item-value="id"
item-title="name"
></v-autocomplete>
stockSelected(selected_stock) {
console.log(selected_stock);
}
在Vuetify 3中,似乎不再存在这个事件。我该如何在Vuetify 3中跟踪选择更改?
英文:
In Vuetify 2 there was a change event for the v-autocomplete component. An example:
<v-autocomplete
label="Choose stock"
v-model="selected_stock"
:items="current_stocks"
:change="stockSelected"
item-value="id"
item-title="name"></v-autocomplete>
stockSelected(selected_stock) {
console.log(selected_stock);
}
In Vuetify 3 this event doesn't seem to exist anymore. How can I track a selection change in Vuetify 3?
答案1
得分: 3
我猜测@change
事件被移除了,因为它是多余的,你可以只监听@update:modelValue
事件:
<v-autocomplete
v-model="selected_stock"
@update:modelValue="stockSelected"
...
></v-autocomplete>
英文:
I guess the @change
event was removed because it is redundant, you can just listen to the @update:modelValue
event:
<v-autocomplete
v-model="selected_stock"
@update:modelValue="stockSelected"
...
></v-autocomplete>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论