[Vuejs]-Use dropdown selected data Vue js

0👍

First of all I’d make use of the select event of vue-multiselect:

<multiselect v-model="order.orderJCname" id="orderJCname" name="orderJCname" :options="orderRCnameoptions" label="nicename" @select="onSelect"></multiselect>

Then in your vue components you create the according method, which stores the selected value:

methods: {
    onSelect(selectedOption, id) {
        this.selectedOption = selectedOption;
    }
}

Last part would be the binding to those 3 text boxes you mentioned. All of them should reference the same data field:

<input type="text" name="text1" v-model="selectedOption.key1" />
<input type="text" name="text2" v-model="selectedOption.key2" />
<input type="text" name="text3" v-model="selectedOption.key3" />

Cheers!

Leave a comment