From 865574ec4c75f3be626ee8602129eae84ea8bef4 Mon Sep 17 00:00:00 2001 From: lyc Date: Mon, 2 Dec 2024 16:26:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=AB=A0=E8=8A=82=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/choose-textbook/index.vue | 22 ++++++++++++------- .../src/components/window-tools/index.vue | 7 +++++- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/renderer/src/components/choose-textbook/index.vue b/src/renderer/src/components/choose-textbook/index.vue index 3c4414d..2f5f0a2 100644 --- a/src/renderer/src/components/choose-textbook/index.vue +++ b/src/renderer/src/components/choose-textbook/index.vue @@ -139,16 +139,22 @@ const handleNodeClick = (data) => { * data : 当前节点数据 */ let nodeData = cloneDeep(toRaw(data)); - //增加一个label 之前取的label nodeData.label = nodeData.itemtitle - // 父级节点 如果当前是一级节点 父级则为null - let parent = { - id: nodeData.parentid, - label: nodeData.parenttitle, - itemtitle: nodeData.parenttitle - } - const parentNode = nodeData.parentid ? parent : null + + let parentNode + // 父级id == rootid 说明当前节点为一级节点 + if(nodeData.parentid == nodeData.rootid){ + parentNode = null + } + else{ + parentNode = { + id: nodeData.parentid, + label: nodeData.parenttitle, + itemtitle: nodeData.parenttitle + } + } + nodeData.parentNode = parentNode let curData = { textBook: { diff --git a/src/renderer/src/components/window-tools/index.vue b/src/renderer/src/components/window-tools/index.vue index da66f80..7799ee9 100644 --- a/src/renderer/src/components/window-tools/index.vue +++ b/src/renderer/src/components/window-tools/index.vue @@ -8,9 +8,10 @@