- 案例代码
<el-row v-for="(item,index) in formData.acTypeCrews":key="index"class="acTypeCrew-row"><el-col :span="24"><el-checkbox v-model="item.checkbox"@change="(query) => changeSelected(query, index)">{{item.acTypeCrew}}</el-checkbox></el-col>
</el-row>
- 核心代码公式:
事件名称: @change
默认参数: (query)
绑定事件: => changeSelected
默认参数+ 新参数: (query, index)
@change="(query) => changeSelected(query, index)"
// 改变选中状态
changeSelected (val, index) {// 第几行被勾选或取消勾选console.log('val', val, index)
},