当前位置:网站首页>El table lazy load refresh
El table lazy load refresh
2022-06-30 05:21:00 【Yanhui】
el-table Lazy load refresh problem
problem
The list query uses element-ui Of table Component implemented , There is a hierarchical display between the data , By default, only primary data is queried and displayed , Sub level data needs to pass through load Lazy load to query . The problems that arise from this , For example, users can query today's data , and load Child data , And then query yesterday's data , Only level 1 data is updated , The secondary data did not disappear and formed dirty data
Specific code implementation
html page
<el-table ref="xxxTable"
el-table add ref attribute
JS part
data:{
maps: new Map(), // Used to store Data lazily loaded by child nodes
}
methods:{
// Lazy loading method
load(tree, treeNode, resolve) {
const pid = tree.id;
vm.maps.set(pid,{
tree,treeNode,resolve});
...
}
}
// Add the following code to the query method
// Clear the cache or force the data of all expanded child nodes to be refreshed
vm.$data.maps.forEach(function(value,key){
const {
tree,treeNode,resolve} = vm.$data.maps.get(key);
// Retract child nodes , Call again the next time you click load Method to query in the background
vm.$set(vm.$refs.loadTable.store.states.treeData[key], "loaded", false);
vm.$set(vm.$refs.loadTable.store.states.treeData[key], "expanded", false);
// Empty cache
vm.$set(vm.$refs.loadTable.store.states.lazyTreeNodeMap, key, []);
// Force reload of child nodes
// vm.load(tree,treeNode,resolve);
});
Different parts
The relevant information inquired on the Internet is this.$set And so on , But the development project is every html The page references vue.js, And today's popular vue The project is not quite the same , So we need to use vm start ,
vm Is in $(function () {}) Defined in
$(function () {
vm = new Vue({
el: '#body',
data: {
}
});
}
边栏推荐
- Visualization of 3D geological model based on borehole data by map flapping software
- Unity ugui text value suspended enlarged display add text background
- GoLand No Tests Were Run : 不能使用 fmt.Printf() &lt;BUG&gt;
- Nestjs configures static resources, template engine, and post examples
- Wechat applet training 2
- Unity3d learning notes-1 (C # learning)
- Chapter 10 of OpenGL super classic (7th Edition) calculation shader
- Use the code cloud publicholiday project to determine whether a day is a working day
- 旋转框目标检测mmrotate v0.3.1 学习配置
- 企事业单位源代码防泄露工作该如何进行
猜你喜欢

VFPBS上传EXCEL并保存MSSQL到数据库中

Unity + hololens publishing settings

【LeetCode】Easy | 225. Using queue to realize stack (pure C manual tearing queue)

How to judge the quality of network transformer? What symptom is network filter transformer broken?

The file has been downloaded incorrectly!

图扑软件基于钻孔数据的三维地质模型可视化

Unity- the camera follows the player

Unity 3D model operation and UI conflict Scrollview

【VCS+Verdi联合仿真】~ 以计数器为例

Procedural animation -- inverse kinematics of tentacles
随机推荐
Postman 做测试的 6 个常见问题
Unity shader flat shadow
Bessel curve with n control points
Win10 vs2015 compiling curaengine
Responding with flow layout
unity 扫描圈 圆扩展方法
Force buckle 27 Removing Elements
Unity notes_ SQL Function
GoLand No Tests Were Run : 不能使用 fmt.Printf() &lt;BUG&gt;
Unity scroll view element drag and drop to automatically adsorb centering and card effect
Log writing specification
Unity publishing /build settings
Chapter 12 pipeline monitoring of OpenGL super classic (version 7)
很紧张,第一天做软件测试,需要做什么?
Database base (Study & review for self use)
东塔攻防世界—xss绕过安全狗
PWN Introduction (2) stack overflow Foundation
旋转框目标检测mmrotate v0.3.1 学习配置
[notes] unity webgl input Chinese
Unity multiple UI page turning left and right