[Vuejs]-Convert select to vue-select with dynamic data (Laravel & Vuejs)

0👍

Assuming that invProducts is an array of product objects and each product object has a product_name property, try this snippet.

<v-select @input="selectChange()"   :label="product_name" :options="invProducts" v-model="selectedProduct">

</v-select>

Create a new data property called selectedProduct and bind it to the vue-select component. So, whenever the selection in the vue-select changes, the value of selectedProduct also changes. In addition to this, @input event can be used to trigger a method in your component. You can get the selected product in that method and do further actions within that event listener.

methods: {

 selectChange : function(){
 console.log(this.selectedProduct);
 //do futher processing

}

Leave a comment