Let me talk about the realization of page turning without clearing
1. First add type="selection
" Type " in the first column of the table . 2. Add 3 to the label . Add the methodel-table-column
:reserve-selection="true"
el-table
:row-key="getRowKeys"
methods
getRowKeys
// 指定一个唯一标识。id或者其他唯一的
getRowKeys (row) {
return row.material;
},
Final code
<el-table height="445px" :cell-style="{padding:'5px'}" :data="materialArr.slice((currentPage-1)*pagesize,currentPage*pagesize)" ref="materialTable" :border="true" :row-key="getRowKeys">
<el-table-column type="selection" width="50" align="center" :reserve-selection="true"></el-table-column>
<el-table-column type="index" :index="indexMethod" label="序号" width="60px"></el-table-column>
<el-table-column property="material" label="物品编号" width="170px"></el-table-column>
<el-table-column property="materialDesc" label="名称" width="200px" :show-overflow-tooltip="true"></el-table-column>
<el-table-column property="materialSpec" label="规格型号" width="150px"></el-table-column>
<el-table-column property="unitDesc" label="单位" width="70px"></el-table-column>
<el-table-column property="materialTypeDesc" label="物品类型" width="90px"></el-table-column>
<el-table-column property="salePrice" label="销售单价" width="90px"></el-table-column>
<el-table-column property="materialBrand" label="品牌" :show-overflow-tooltip="true"></el-table-column>
<el-table-column property="materialFactory" label="制造厂家" :show-overflow-tooltip="true"></el-table-column>
</el-table>
methods: {
// 指定一个唯一标识。id或者其他唯一的
getRowKeys (row) {
return row.material;
},
}
After implementing this, it is found that the original el-table selection selection will not be cleared after the submission operation
1. el-table
Add the tag ref="materialTable"
2. Add the following code when you need to clear it
this.$refs.materialTable.clearSelection();