tree组件初步优化

This commit is contained in:
禺狨
2023-03-21 12:12:36 +08:00
parent 1125159c6c
commit 629973babe
2 changed files with 41 additions and 30 deletions

View File

@@ -31,12 +31,10 @@ export const TreeCategory = (props: PropInterface) => {
new_arr.unshift({
key: 0,
title: (
<div className="d-flex">
<span className="tree-num">
({props.categoryCount[0] || 0})
</span>
</div>
<>
<span></span>
<span className="tree-num">{props.categoryCount[0] || 0}</span>
</>
),
});
}
@@ -51,12 +49,12 @@ export const TreeCategory = (props: PropInterface) => {
for (let i = 0; i < categories[id].length; i++) {
if (!categories[categories[id][i].id]) {
let name = (
<div className="d-flex">
{categories[id][i].name}
<>
<span className="tree-title-elli">{categories[id][i].name}</span>
<span className="tree-num">
({props.categoryCount[categories[id][i].id] || 0})
{props.categoryCount[categories[id][i].id] || 0}
</span>
</div>
</>
);
arr.push({
title: name,
@@ -64,12 +62,12 @@ export const TreeCategory = (props: PropInterface) => {
});
} else {
let name = (
<div className="d-flex">
{categories[id][i].name}
<>
<span className="tree-title-elli">{categories[id][i].name}</span>
<span className="tree-num">
({props.categoryCount[categories[id][i].id] || 0})
{props.categoryCount[categories[id][i].id] || 0}
</span>
</div>
</>
);
const new_arr: Option[] = checkArr(categories, categories[id][i].id);
arr.push({
@@ -112,8 +110,10 @@ export const TreeCategory = (props: PropInterface) => {
onSelect([], "");
}}
>
{props.text}
<span className="tree-num">({props.resourceTotal})</span>
<div className="j-b-flex">
<span>{props.text}</span>
<span className="tree-num-total">{props.resourceTotal}</span>
</div>
</div>
<Tree
onSelect={onSelect}