Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) | - |
Expand Down
7 changes: 6 additions & 1 deletion src/components/Tree/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 =
Expand Down