Skip to content

Commit bb68ea8

Browse files
author
wuchao
committed
1. Explain the necessity of adding node-key in virtual scrolling;
2. Optimize the rendering problem when dom is reused
1 parent a5b54c5 commit bb68ea8

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ export default {
7878

7979
## Usage:
8080

81+
:warning: When using virtual scrolling, `node-key` must be set
82+
8183
```html
8284
<template>
8385
<div class="ve-tree" style="height:calc(100vh - 20px)">

README.zh-CN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ export default {
7878

7979
## 使用:
8080

81+
:warning: 在使用虚拟滚动时,必须设置 `node-key`
82+
8183
```html
8284
<template>
8385
<div class="ve-tree" style="height:calc(100vh - 20px)">

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "@wchbrad/vue-easy-tree",
33
"description": "A Vue.js project",
4-
"version": "1.0.5",
4+
"version": "1.0.6",
55
"author": "wchbrad <[email protected]>",
66
"license": "MIT",
7-
"private": false,
7+
"private": true,
88
"main": "./dist/vue-easy-tree.js",
99
"keywords": [
1010
"virtual",

src/components/ve-tree.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@ export default {
235235
return treeData.reduce((smoothArr, data) => {
236236
if (data.visible) {
237237
// Mark different types to avoid being optimized out when assembled into the same dom
238-
data.type = `${data.level}-${data.expanded}-${data.checked}`;
238+
data.type = this.showCheckbox
239+
? `${data.level}-${data.checked}-${data.indeterminate}`
240+
: `${data.level}-${data.expanded}`;
239241
smoothArr.push(data);
240242
}
241243
if (data.expanded && data.childNodes.length) {

0 commit comments

Comments
 (0)