mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
树样式优化。
This commit is contained in:
parent
8d3bd81c99
commit
2c50668b4a
@ -23,18 +23,18 @@ class Tree extends React.Component {
|
||||
list.push(this.createNode(n));
|
||||
});
|
||||
|
||||
return <ul>{list}</ul>;
|
||||
return <ul className={classNames('Tree', className)} style={style}>{list}</ul>;
|
||||
}
|
||||
|
||||
createNode(data) {
|
||||
const leaf = !data.children || data.children.length === 0;
|
||||
const children = leaf ? null : (<ul>{data.children.map(n => {
|
||||
const children = leaf ? null : (<ul className={'sub'}>{data.children.map(n => {
|
||||
return this.createNode(n);
|
||||
})}</ul>);
|
||||
|
||||
return <li value={data.value} key={data.value}>
|
||||
return <li className={'node'} value={data.value} key={data.value}>
|
||||
<a href={'javascript:;'}>{data.text}</a>
|
||||
{leaf ? null : <ul>{children}</ul>}
|
||||
{leaf ? null : children}
|
||||
</li>;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
.Tree {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.Tree .node a {
|
||||
color: #555;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.Tree .node .sub {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0 0 0 16px;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user