diff --git a/src/components/ItemTree/index.jsx b/src/components/ItemTree/index.jsx index 9b37b67..549ac87 100644 --- a/src/components/ItemTree/index.jsx +++ b/src/components/ItemTree/index.jsx @@ -190,7 +190,7 @@ const ItemTree = (prop) => { } else { // 打开文件 dispatch(addTableBarItem({ - label: e.node.title, + label: e.node.title.props.children[0], children: e.node.key, key: e.node.key, activeKey: e.node.key diff --git a/src/redux/tableBarItem_reducer.js b/src/redux/tableBarItem_reducer.js index 99b55be..592771b 100644 --- a/src/redux/tableBarItem_reducer.js +++ b/src/redux/tableBarItem_reducer.js @@ -18,9 +18,9 @@ export const tableBarItemSlice = createSlice({ }, reducers: { addTableBarItem: (state, action) => { - console.log("tableBarItemSlice:tableBarItem", state, action,) + console.log("tableBarItemSlice:addTableBarItem", state, action) if (state.data.filter(file=>file.key===action.payload.key).length===0){ - state.data.push(action.payload) + state.data.push({"label":action.payload.label,"key":action.payload.key,"children":action.payload.children}) } if (action.payload.activeKey){ state.activeKey=action.payload.activeKey