潇潇雨雨
<template>
<el-checkbox-group v-model="checkList1" @change="onChange1">
<el-checkbox label="A"></el-checkbox>
<el-checkbox label="B"></el-checkbox>
<el-checkbox label="C"></el-checkbox>
</el-checkbox-group>
<el-checkbox-group v-model="checkList2" @change="onChange2">
<el-checkbox label="A"></el-checkbox>
<el-checkbox label="B"></el-checkbox>
<el-checkbox label="C"></el-checkbox>
</el-checkbox-group></template>data () { return { checkList1: ['A'], checkList2: ['B'],
};
}, methods: { onChange1: function(val) {
val.forEach((el) => { let pos = this.checkList2.indexOf(el) if (~pos) { this.checkList2.splice(pos, 1)
}
})
}, onChange2: function(val) {
val.forEach((el) => { let pos = this.checkList1.indexOf(el) if (~pos) { this.checkList1.splice(pos, 1)
}
})
}
}这种方式是否合适