vue操作select获取option值 用@change件事
@change=“changeProduct($event)” 动态传递参数
vue操作select获取option的ID值
如果select的v-model(value)与option绑定的value值一致。
那么就会显示option中的值 {{item.title}}–>
<div id="app">
<select @change="QhCityByID($event)" v-model="q.CityByID">
<option v-for="(item,index) in City" :key="index" :value='item.id'>{{item.name}}</option>
</select>
</div>
data:{
City:[{id:1,title:"北京"},{id:2,title:"上海"},{id:3,title:"广州"},{id:4,title:"四川"}],
ProductActive:null,
},
methods: {
changeProduct(event) {
this.ProductActive = event.target.value; //获取option对应的value值
},
}