赞
踩
1.table序号中的prop名称与数据库中字段ID以示区分,如图所示:
2.通过:row-class-name="tableRowClassName"方法进行序号的掩饰与显示,如图所示:
- <el-table
- :row-class-name="tableRowClassName"
- border
- :data="tableData"
- style="width: 100%"
- height="300"
- row-key="id"
- >
-
- tableRowClassName({row, rowIndex}) {
- row.tableId = rowIndex+1;
- },
3.通过绑定方法进行当前行数据赋值操作,如图所示:
- <el-table-column prop="xm" label="作者姓名">
- <template slot-scope="scope">
- <el-input v-if="scope.row.lx != '1'" v-model="scope.row.xm" placeholder="作者姓名" clearable>
- </el-input>
- <el-autocomplete
- v-if="scope.row.lx == '1'"
- v-model="scope.row.xm"
- :fetch-suggestions="querySearchAsync"
- placeholder="请输入内容"
- @select="changeInfo($event,scope.row.index,scope.row)">
- <template slot-scope="{ item }">
- <div>{{ item.label }}</div>
- </template>
- </el-autocomplete>
- </template>
- </el-table-column>
-
-
- //赋值
- changeInfo(item,index,row){
- console.log(index,row,'===============================')
- this.tableData[row.tableId-1].xm = item.xm;
- this.tableData[row.tableId-1].gzbmmc = item.dwh;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。