Vue element 树表懒加载新增,删除等操作后进行节点或者局部刷新可使用
this.$set(this.$refs.table.store.states.lazyTreeNodeMap, id, res.data.data);
参数一:自带的方法
参数二:需要刷新的节点
参数三:该节点下需要加入的数据
refreshRow(id){
let params = {
parentId: id
}
getPbs(params).then(res => {
this.$set(this.$refs.table.store.states.lazyTreeNodeMap, id, res.data.data)
})
},
handleDelete(row) {//删除
this.$confirm('确定要删除该数据吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deletePbs(row.id).then(res => {
if (res.data.code = 200) {
this.$message({
type: 'success',
message: '删除成功!'
});
if(row.parentId){
this.refreshRow(row.parentId);
}else{
this.getPbs(0);
}
}
})
}).catch(() => { });
},
this.$set(this.$refs.table.store.states.lazyTreeNodeMap, id, res.data.data);