tree组件点击后分类名获取

This commit is contained in:
禺狨 2023-05-09 10:02:42 +08:00
parent 9477110a0b
commit f4aa89746b

View File

@ -120,7 +120,7 @@ export const TreeDepartment = (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; label = info.node.title.props.children;
} }
props.onUpdate(selectedKeys, label); props.onUpdate(selectedKeys, label);
setSelectKey(selectedKeys); setSelectKey(selectedKeys);
@ -129,7 +129,7 @@ export const TreeDepartment = (props: PropInterface) => {
const onExpand = (selectedKeys: any, info: any) => { const onExpand = (selectedKeys: any, info: any) => {
let label = "全部" + props.text; let label = "全部" + props.text;
if (info) { if (info) {
label = info.node.title; label = info.node.title.props.children;
} }
props.onUpdate(selectedKeys, label); props.onUpdate(selectedKeys, label);
setSelectKey(selectedKeys); setSelectKey(selectedKeys);