补充:
-
第一次创建选择来了部分配件(左侧多选框),修改的时候,先动态查询配件列表,再将选择的那些给反显上去。 如下,无效
watch: {
dialogTableVisible(val){ if(val){ //弹框 弹出时 反显已选中 this.$nextTick(()=>{ this.productListData1.forEach((item,index)=>{//选中数据 this.productListData.forEach((listItem,listIndex)=>{ //配件列表所有数据 if(item.id == listItem.id){ this.$refs.productListTable.toggleRowSelection(listItem); } }) }) }) } } }
- 表格单选
我是修改别人的代码,如下实现的单选。
暂时只在处理多选,但是单选我看了一下,表格中每一行都用的这个v-model="radioNum",同一个变量。。没见过这种用法。。。
<el-table-column label="是否默认配件" prop="isDefault" width="130" align='center'>
<template slot-scope="scope">
<div v-if="scope.row">
<el-radio v-model="radioNum" :label="scope.$index" @change.native="radioChange(scope)" > </el-radio>
</div>
</template>
</el-table-column>
更新 2019年3月22日08:18:17
<el-radio v-model="radioNum" :label="scope.$index" @change.native="radioChange(scope)" > </el-radio>
其实重点就是
v-model
和:label
分析一下就是点一下 v-model 会变成 $index。所有咯,取值用 index 取。回显就给 v-model 赋值对应的下标咯
反显?反选?
http://element-cn.eleme.io/#/...