<div class="account-item" v-for="item in accountList" :key="item.id" :class="[ { 'is-select-mode': isSelectMode }, { 'is-select': item.isSelect } ]" @click="selectItemClick(item)" > <el-checkbox v-if="isSelectMode" v-model="item.isSelect" label="" size="large" @click.stop="stopEvent" /> <svg-icon class="svg-icon" icon="icon-custom"></svg-icon> <div class="account-content"> <div class="name">{{ item.name }}</div> <div class="phone">{{ item.phone }}</div> <div class="email">{{ item.email }}</div> <div class="address">{{ item.address }}</div> </div> </div>
点击div时,点击div取消,勾选复选框是正常的,但是点击复选框却失效,这是由于冒泡,相当于改了两次checked的值,造成值没变,只需要给checkbox的点击事件取消冒泡就可以了。
标签:checkbox,勾选,复选框,item,点击,div From: https://www.cnblogs.com/guwufeiyang/p/17930264.html