# 项目场景:
element table分页多选列表,使用reserve-selection,获取多选数据时正常,但是返显出现问题。返显后,再次选择,没有打开的列表页数据会丢失。
# 问题描述:
保存数据后,再次进入选择,只在第一页操作多选,发现已经保存的第2页,第3页数据丢失。
# 原因分析:
定位后发现,reserve-selection有缺陷问题。已查看过的分页数据可以正常获取。没有调用的分页的数据,框架是无法处理的。这种只适用于一次保存。
# 解决方案:
1.获取已经保存的数据
async getProductList() {
this.loading = true;
this.push = true;
const data = await getproductIndexesSelections({
page: this.pageData.page,
per_page: this.pageData.perPage,
...this.queryData,
categoryId:
this.queryData.categoryId && this.queryData.categoryId.length
? this.queryData.categoryId[this.queryData.categoryId.length - 1]
: "",
});
let result = data.items;
this.pageData.perPage = data.per_page;
this.pageData.totalNum = data.total;
this.tableData = result
? result.map((item) => {
if (!item.images) item.images = [];
if (this.single) return item;
this.value.forEach((v) => {
if (v.spu_code === item.spu_code && v.bar_code === item.bar_code) {
item.check = true;
item.sequence = v.sequence
}
});
return item;
element-table表格分页多选
最新推荐文章于 2024-05-11 02:51:05 发布