0👍
Change the @change
event to input
element.
html:
<div id="app">
<b-form-input list="my-list-id" id="input-with-list" @input="changeSelectedItem" ></b-form-input>
<datalist id="my-list-id">
<option v-for="size in sizes">{{ size }}</option>
</datalist>
</div>
component:
data() {
return {
options: ['1', '2', '3', '4']
}
},
methods: {
changeSelectedItem(e) {
this.option = e
}
}
if you want to get the index of item, or other data about it, you can loop over your size
list.
- [Vuejs]-How to match Node.js server's ESLint rules to my Vue.js frontend's ESLint rules?
- [Vuejs]-How do I use the render function correctly in Vue?
Source:stackexchange.com