選擇某個列表之后 , 勾選幾列數(shù)據(jù)后 , 再次點進去如何把之前勾選的數(shù)據(jù)在這個列表上回顯勾選的項 , 解決方法如下 :
onLoad(page, params = {}) {
this.loading = true;
getList(page.currentPage,page.pageSize, Object.assign(params, this.query)).then(res => {
this.page.total = res.data.data.total;
this.data = res.data.data.records;
let selectionList = this.data.filter(item => {
for(let i = 0; i < this.idsList.length; i++){
if(this.idsList[i] === item.id) return true;
}
return false;
});
this.$nextTick(() => {
this.$refs.crud.toggleSelection(selectionList);
});
this.loading = false;
})
}