vue 多个下拉如何去重

有N个下拉框 然后用1个model集合

如何实现 当某个下拉框选中1个值之后 其他下拉框的不显示选中的值呢

可否提供点思路呢

我本来是想用计算属性 但是计算属性是不能传参的 所以不能定位到当前的下拉框(因为其他的下拉肯定是不显示当先下拉框的选中 而当前的下拉肯定是有这个值的)

比如说下拉框1 选中值为A的项 我想实现的是 其他的下拉框是不显示A项的 但是下拉框1还是有A的
当下拉框1选中了B的时候 其他的下拉框A显示了 B消失了


ITMISS
浏览 1094回答 1
1回答

拉风的咖菲猫

计算属性不能传参,但是能获得选中的值啊<select v-model="select1">&nbsp; &nbsp; <option ...>...</option></select>...{&nbsp; &nbsp; data:{&nbsp; &nbsp; &nbsp; &nbsp; select1: "A",&nbsp; &nbsp; &nbsp; &nbsp; select2: "B",&nbsp; &nbsp; &nbsp; &nbsp; select3: "C"&nbsp; &nbsp; },&nbsp; &nbsp; computed: {&nbsp; &nbsp; &nbsp; &nbsp; option() {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 可以使用this.select1获取选中的值&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return optionAll.filter(this.select1)&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; }}
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript