hy-virtual-tree 1.1.22 → 1.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/index.js +5 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -2189,24 +2189,24 @@ class VirtualTree {
|
|
|
2189
2189
|
let cacheTimer;
|
|
2190
2190
|
let cacheTime = Date.now();
|
|
2191
2191
|
const cacheInterval = 500;
|
|
2192
|
-
|
|
2192
|
+
let cacheData = [];
|
|
2193
2193
|
return async (data, callback) => {
|
|
2194
2194
|
if (!this._tree)
|
|
2195
2195
|
return;
|
|
2196
2196
|
cacheTimer && clearTimeout(cacheTimer);
|
|
2197
2197
|
if (Array.isArray(data)) {
|
|
2198
2198
|
data.forEach((item) => {
|
|
2199
|
-
cacheData.
|
|
2199
|
+
cacheData.push(item);
|
|
2200
2200
|
});
|
|
2201
2201
|
}
|
|
2202
2202
|
else {
|
|
2203
|
-
cacheData.
|
|
2203
|
+
cacheData.push(data);
|
|
2204
2204
|
}
|
|
2205
2205
|
// cacheInterval毫秒仅更新一次数据
|
|
2206
2206
|
if (Date.now() - cacheTime >= cacheInterval) {
|
|
2207
2207
|
cacheTime = Date.now();
|
|
2208
|
-
|
|
2209
|
-
cacheData
|
|
2208
|
+
this._updateTree([...cacheData]);
|
|
2209
|
+
cacheData = [];
|
|
2210
2210
|
this._refreshVirtualScroll();
|
|
2211
2211
|
callback && callback();
|
|
2212
2212
|
}
|