From 1085c400a3612d95f0876c351b8b885c99db7297 Mon Sep 17 00:00:00 2001 From: * <8> Date: Tue, 22 Mar 2022 19:54:31 +0800 Subject: [PATCH 01/22] Match-id-f9eaf1cfccee2ac7b3b2f5b071385d1356d11320 --- libs/extension/src/components/VTree.tsx | 103 ++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 libs/extension/src/components/VTree.tsx diff --git a/libs/extension/src/components/VTree.tsx b/libs/extension/src/components/VTree.tsx new file mode 100644 index 00000000..040ea892 --- /dev/null +++ b/libs/extension/src/components/VTree.tsx @@ -0,0 +1,103 @@ +import { useState } from 'horizon'; + +export interface IData { + id: string; + name: string; + indentation: number; + userKey: string; +} + +type IItem = { + style: any, + hasChild: boolean, + onExpand: (id: string) => void, +} & IData + +// TODO: 计算可以展示的最多数量,并且监听显示器高度变化修改数值 +const showNum = 50; +const divHeight = 21; + +function Item({ name, style, userKey, hasChild, onExpand, id, indentation }: IItem) { + const key = userKey === '' ? '' : ` key = '${userKey}'`; + const showIcon = hasChild ? '△' : ''; + const onClickExpand = () => { + onExpand(id); + } + return ( +
LogUtils.log('p capture')} onClick={() => LogUtils.log('p bubble')}> +
+LogUtils.log('p capture')} onClick={() => LogUtils.log('p bubble')}> +
+LogUtils.log('p capture')} onClick={() => LogUtils.log('p bubble')}> +
++ +
+{this.state.num}
+{this.state.price}
+ + + > + ); + } + } + Horizon.render(