diff --git a/README.md b/README.md index 4146376..7517d31 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,7 @@ plugins: [ | showDoubleQuotes | normal | Whether to show doublequotes on key | boolean | true | | virtual | normal | Whether to use virtual scrolling, usually used for big data | boolean | false | | itemHeight | normal | The height of each item when using virtual scrolling | number | auto | +| virtualLines | normal | The number of lines to render when virtual scrolling is enabled | number | 10 | | v-model | higher | Defines value when the tree can be selected | string, array | - | | path | higher | Root data path | string | root | | pathSelectable | higher | Defines whether a data path supports selection | function(path, content) | - | diff --git a/src/components/Tree/index.vue b/src/components/Tree/index.vue index bcd0ee1..aa0cbca 100644 --- a/src/components/Tree/index.vue +++ b/src/components/Tree/index.vue @@ -127,6 +127,11 @@ export default { type: Function, default: null, }, + // Number of lines to show when virtual is true + virtualLines: { + type: Number, + default: 10 + } }, data() { return { @@ -217,7 +222,7 @@ export default { methods: { onTreeScroll() { if (this.virtual) { - const visibleCount = 10; + const visibleCount = this.virtualLines; const scrollTop = (this.$refs.tree && this.$refs.tree.scrollTop) || 0; const scrollCount = Math.floor(scrollTop / this.itemHeight); let start =