javascript
<el-checkbox-group v-model="checkedMarker" @change="markerChange">
<div v-for="(item, index) in markerList" :key="index">
<el-checkbox :label="item.name" class="markerItem" @change="getWhatMarker">{{ item.name }}</el-checkbox>
<div v-if="index === 0" class="lineRight" />
</div>
</el-checkbox-group>
data() {
return {
checkedMarker: [],
markerList: [
{
id: -1,
name: "故障设备",
checked: true
},
{
id: -1,
name: "路口",
checked: false
},
], // 省略.......
}
},
markerChange(e) {
console.log(e) // ['故障设备', '视频监控']
},
getWhatMarker(e, name) {
console.log(e, name.target._value) // true '视频监控'
},