我找不到一种方法来清除选择项目后调用的方法“afterselection”中的选择字段:
模板:
<v-select
:items="adrlist"
@input="afterselection"
></v-select>
选择中的数据:
const addressList = [{
"text":"Street 523, 2533",
"value":[1723455.7054408004,5923451.382843224]},
{"text":"Lala 3, 3455",
"value":[1723455.7054408004,5923451.382843224],
}]
Vue 代码:
new Vue({
el: '#app',
data () {
return {
adrlist: addressList,
}
},
methods:{
afterselection(item){
console.log(item);
//here I want to clear the select
},
},
})
这是带有此示例的代码笔:
codepen example
我试图将 v-model 设置为 null,但这不起作用。
我已经研究并尝试了几天,但我真的找不到解决方案:-/
最佳答案
仅供引用,您可以使用以下命令清除 vuetify 中的选择字段
this.$nextTick(() => {
this.selected = null
})
重要的是“nextTick”!否则它不会被渲染......
请参阅 vuetify-dev 提供的此代码笔:
working codepen
关于vuetify.js - 选择项目后自动清除选择字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48869649/