Match-id-af5f4471321b0cdce3f5343e1c2f451887b30c17

This commit is contained in:
* 2022-03-23 11:08:28 +08:00 committed by *
parent dec773daef
commit 5f042d8fa8
3 changed files with 35 additions and 20 deletions

View File

@ -0,0 +1,10 @@
.tree_container {
position: absolute;
width: 100%;
height: 100%;
overflow-y: auto;
}
.tree_item{
width: 100%;
}

View File

@ -1,4 +1,5 @@
import { useState } from 'horizon';
import styles from './VTree.less';
export interface IData {
id: string;
@ -24,7 +25,7 @@ function Item({ name, style, userKey, hasChild, onExpand, id, indentation }: IIt
onExpand(id);
}
return (
<div style={style}>
<div style={style} className={styles.tree_item}>
<div style={{ display: 'inline-block', marginLeft: indentation * 20, width: 10 }} onClick={onClickExpand} >{showIcon}</div>
{name + key}
</div>
@ -72,7 +73,6 @@ function VTree({ data }: { data: IData[] }) {
style={{
position: 'absolute',
transform: `translateY(${totalHeight}px)`,
width: '100%'
}}
onExpand={changeExpandNode}
{...item} />
@ -92,7 +92,7 @@ function VTree({ data }: { data: IData[] }) {
}
return (
<div style={{ position: 'absolute', width: '100%', height: '100%', overflowY: 'auto' }} onScroll={scroll}>
<div className={styles.tree_container} onScroll={scroll}>
{showList}
{/* 确保有足够的高度 */}
<div style={{ marginTop: totalHeight }} />

View File

@ -16,24 +16,29 @@ module.exports = {
extensions: ['.ts', '.tsx', '.js']
},
module: {
rules: [{
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env',
'@babel/preset-typescript',
['@babel/preset-react', {
runtime: 'classic',
"pragma": "Horizon.createElement",
"pragmaFrag": "Horizon.Fragment",
}]],
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env',
'@babel/preset-typescript',
['@babel/preset-react', {
runtime: 'classic',
"pragma": "Horizon.createElement",
"pragmaFrag": "Horizon.Fragment",
}]],
}
}
}
]
}]
]
},
{
test: /\.less/i,
use: ["style-loader", { loader: "css-loader", options: { modules: true } }, 'less-loader'],
}]
},
externals: {
'horizon': 'Horizon',