My question pertains to my plugin vue-select@latest. I have been able to successfully retrieve data from the object cities, but I am struggling with how to add a value, such as
<span class="selected-tag" value="Moscow" or value="New York">
As a newcomer to Vue.js, I am attempting to utilize the plugin vue-select. However, I am encountering difficulties in adding the value attribute. Despite multiple attempts, I have not been successful.
<v-select :options="locations" label="name" v-model="country" value="value" ></v-select>
I am generating a dynamic combobox from the object cities: ['Moscow', 'Sp', 'Tomsk', 'Voronezh', 'Novossibirsk']. My goal is to assign all the data from the combobox to the value attribute, for instance, value="Moscow".
let sample = new Vue({
el: '#app',
data: {
country: null,
city: null,
locations: [
{
name: 'Russia',
cities: ['Moscow', 'Sp', 'Tomsk', 'Voronezh', 'Novossibirsk'],
value: ['Moscow', 'Sp', 'Tomsk', 'Voronezh', 'Novossibirsk']
},
{
name: 'USA',
cities: ['LA', 'Pensacola', 'New York'],
value: ['LA', 'Pensacola', 'New York']
}
]
},
codepen link My cdn library
<script src="https://unpkg.com/vue-select@latest"></script>