<div id="app">
<select v-model="cur" @change="show">
<option value>請選擇</option>
<option :value="item.id" v-for="item in arr">{{item.text}}</option>
</select>
<select v-model="cur" @change="show">
<option value>請選擇</option>
<option :value="item.id" v-for="item in arr2">{{item.text}}</option>
</select>
</div>var vm = new Vue({
el: '#app',
data: {
cur: '',
arr:[
{id: 1,text:'hhh'},
{id: 2,text:'xxx'}
],
arr2:[
{id: 3,text:'a3'},
{id: 4,text:'a4'}
]
},
methods: {
show: function() {
console.log(this.cur)
}
}
})頁面中有兩個(gè)選項(xiàng)用一個(gè)字段,使用vue做了之后,選擇其中一個(gè),兩個(gè)都變成了空。我想實(shí)現(xiàn)的效果是選擇其中一個(gè),另一個(gè)變成“請選擇”,該如何實(shí)現(xiàn)?
添加回答
舉報(bào)
0/150
提交
取消