Skip to content

Commit

Permalink
1. Explain the necessity of adding node-key in virtual scrolling;
Browse files Browse the repository at this point in the history
2. Optimize the rendering problem when dom is reused
  • Loading branch information
wuchao committed Feb 15, 2022
1 parent a5b54c5 commit bb68ea8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export default {

## Usage:

:warning: When using virtual scrolling, `node-key` must be set

```html
<template>
<div class="ve-tree" style="height:calc(100vh - 20px)">
Expand Down
2 changes: 2 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export default {

## 使用:

:warning: 在使用虚拟滚动时,必须设置 `node-key`

```html
<template>
<div class="ve-tree" style="height:calc(100vh - 20px)">
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@wchbrad/vue-easy-tree",
"description": "A Vue.js project",
"version": "1.0.5",
"version": "1.0.6",
"author": "wchbrad <[email protected]>",
"license": "MIT",
"private": false,
"private": true,
"main": "./dist/vue-easy-tree.js",
"keywords": [
"virtual",
Expand Down
4 changes: 3 additions & 1 deletion src/components/ve-tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ export default {
return treeData.reduce((smoothArr, data) => {
if (data.visible) {
// Mark different types to avoid being optimized out when assembled into the same dom
data.type = `${data.level}-${data.expanded}-${data.checked}`;
data.type = this.showCheckbox
? `${data.level}-${data.checked}-${data.indeterminate}`
: `${data.level}-${data.expanded}`;
smoothArr.push(data);
}
if (data.expanded && data.childNodes.length) {
Expand Down

0 comments on commit bb68ea8

Please sign in to comment.