当前位置:网站首页>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: {
}
});
}
边栏推荐
- 网络变压器怎么判断好坏?网络滤波变压器坏了一般是什么症状?
- PWN Introduction (2) stack overflow Foundation
- 炒美原油的国际交易平台如何能保障资金安全呢?
- Revit二次開發---未打開項目使用面板功能
- Chapter 9 of OpenGL super classic (version 7): fragment processing and frame buffering
- PKCs 12:personal information exchange syntax v1.1 translation part I
- Unity Catmull ROM curve
- Unit asynchronous jump progress
- ParticleSystem in the official Manual of unity_ Collision module
- Unity + hololens common basic functions
猜你喜欢

Terminal convenient SSH connection

VFPBS上传EXCEL并保存MSSQL到数据库中
![[notes] unity webgl input Chinese](/img/f7/805f510ff691227b4c2b529cc1099a.jpg)
[notes] unity webgl input Chinese

How to prevent source code leakage in enterprises and institutions

MinGW-w64下载文件失败the file has been downloaded incorrectly!

虚析构和纯虚析构

Baiwen.com 7 days Internet of things smart home learning experience punch in the third day

Some problems encountered in unity steamvr

使用码云PublicHoliday项目判断某天是否为工作日

How to judge the quality of network transformer? What symptom is network filter transformer broken?
随机推荐
Chapter 12 pipeline monitoring of OpenGL super classic (version 7)
Operation of JSON file
Bessel curve with n control points
【 VCS + Verdi joint simulation】 ~ Taking Counter as an Example
MinGW-w64下载文件失败the file has been downloaded incorrectly!
Revit secondary development - use panel function without opening the project
Super comprehensive summary | related improvement codes of orb-slam2 / orb-slam3!
How to use js to control the scroll bar of moving div
Revit二次开发---未打开项目使用面板功能
【VCS+Verdi聯合仿真】~ 以計數器為例
The difference between SVG and canvas
Golan no tests were run: fmt Printf() &lt; BUG&gt;
[notes] unity Scrollview button page turning
Unity supports the platform # define instruction of script
旋转框目标检测mmrotate v0.3.1 学习配置
Chapter 9 of OpenGL super classic (version 7): fragment processing and frame buffering
C # uses monopinvokecallback to directly call back C # function
2021-10-31
UnityEngine. JsonUtility. The pit of fromjason()
Unityshader learning notes - Basic Attributes