mirror of
https://github.com/PlayEdu/backend
synced 2025-06-29 15:55:15 +08:00
资源分类组件优化
This commit is contained in:
parent
3162eb1ee1
commit
db20498317
@ -28,7 +28,7 @@ export const TreeCategory = (props: PropInterface) => {
|
|||||||
if (props.type === "no-cate") {
|
if (props.type === "no-cate") {
|
||||||
new_arr.unshift({
|
new_arr.unshift({
|
||||||
key: 0,
|
key: 0,
|
||||||
title: "未分类",
|
title: <span className="tree-title-elli">未分类</span>,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,9 +42,7 @@ export const TreeCategory = (props: PropInterface) => {
|
|||||||
for (let i = 0; i < categories[id].length; i++) {
|
for (let i = 0; i < categories[id].length; i++) {
|
||||||
if (!categories[categories[id][i].id]) {
|
if (!categories[categories[id][i].id]) {
|
||||||
let name = (
|
let name = (
|
||||||
<>
|
<span className="tree-title-elli">{categories[id][i].name}</span>
|
||||||
<span className="tree-title-elli">{categories[id][i].name}</span>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
arr.push({
|
arr.push({
|
||||||
title: name,
|
title: name,
|
||||||
@ -52,9 +50,7 @@ export const TreeCategory = (props: PropInterface) => {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let name = (
|
let name = (
|
||||||
<>
|
<span className="tree-title-elli">{categories[id][i].name}</span>
|
||||||
<span className="tree-title-elli">{categories[id][i].name}</span>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
const new_arr: Option[] = checkArr(categories, categories[id][i].id);
|
const new_arr: Option[] = checkArr(categories, categories[id][i].id);
|
||||||
arr.push({
|
arr.push({
|
||||||
@ -70,9 +66,8 @@ export const TreeCategory = (props: PropInterface) => {
|
|||||||
const onSelect = (selectedKeys: any, info: any) => {
|
const onSelect = (selectedKeys: any, info: any) => {
|
||||||
let label = "全部" + props.text;
|
let label = "全部" + props.text;
|
||||||
if (info) {
|
if (info) {
|
||||||
label = info.node.title.props.children.props.children;
|
label = info.node.title.props.children;
|
||||||
}
|
}
|
||||||
console.log(info);
|
|
||||||
props.onUpdate(selectedKeys, label);
|
props.onUpdate(selectedKeys, label);
|
||||||
setSelectKey(selectedKeys);
|
setSelectKey(selectedKeys);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user