diff --git a/docs/en-US/component/tree-v2.md b/docs/en-US/component/tree-v2.md index 1428a12e03..7a79dfbfed 100644 --- a/docs/en-US/component/tree-v2.md +++ b/docs/en-US/component/tree-v2.md @@ -85,6 +85,7 @@ tree-v2/filter | filter-method | this function will be executed on each node when use filter method. if return `false`, tree node will be hidden. | Function(value, data) | — | | indent | horizontal indentation of nodes in adjacent levels in pixels | number | 16 | | icon | custom tree node icon | `string \| Component` | - | +| item-size | custom tree node height | number | 26 | ## props diff --git a/packages/components/tree-v2/__tests__/tree.test.ts b/packages/components/tree-v2/__tests__/tree.test.ts index 434a616c2f..49a3d0321e 100644 --- a/packages/components/tree-v2/__tests__/tree.test.ts +++ b/packages/components/tree-v2/__tests__/tree.test.ts @@ -122,6 +122,7 @@ const createTree = ( :check-strictly="checkStrictly" :default-expanded-keys="defaultExpandedKeys" :indent="indent" + :item-size="itemSize" :icon-class="iconClass" :expand-on-click-node="expandOnClickNode" :check-on-click-node="checkOnClickNode" @@ -152,6 +153,7 @@ const createTree = ( checkStrictly: false, defaultExpandedKeys: undefined, indent: 16, + itemSize: 26, iconClass: undefined, expandOnClickNode: true, checkOnClickNode: false, @@ -231,6 +233,21 @@ describe('Virtual Tree', () => { expect(el.style.height).toBe('300px') }) + test('item-size', async () => { + const { wrapper } = createTree({ + data() { + return { + itemSize: 40, + } + }, + }) + await nextTick() + const node = wrapper.find('.el-tree-node').element + const content = wrapper.find('.el-tree-node__content').element + expect(node.style.height).toBe('40px') + expect(content.style.height).toBe('40px') + }) + test('props', async () => { const { wrapper } = createTree({ data() { diff --git a/packages/components/tree-v2/src/tree-node.vue b/packages/components/tree-v2/src/tree-node.vue index dd0f65ae5e..f904eac14e 100644 --- a/packages/components/tree-v2/src/tree-node.vue +++ b/packages/components/tree-v2/src/tree-node.vue @@ -19,7 +19,10 @@ >