I'm using a b-form-input with b-form-datalist. The input text boxes will be added dynamically (one per row).
To start off, it lists a few entries. Once a value is chosen, the chosen value will be added to a list using v-model.
<div id="app">
<div v-for="(chosen, index) in chosenValues" :key="chosen.value + '-' + index">
<b-col cols="4">
<b-form-input
list="dropdown"
v-model="chosen.value"
></b-form-input>
<b-form-datalist id="dropdown" :options="elements"></b-form-datalist>
</b-col>
</div>
</div>
Javascript:
new Vue({
el: '#app',
data: {
elements: ['apple', 'orange', 'banana', 'avocado'],
chosenValues: [{value: ''}] //will be added dynamically when a new text box is added
}
})
The problem with this code is that I'm not able to type into the text box i.e., the focus goes away after typing a character - Fiddle-1
If I remove the v-model property or change it into v-bind, it works fine - Fiddle-2