From 8c0fe7e2bca156af2bd1974f3ac57defa7dcd7ca Mon Sep 17 00:00:00 2001 From: xyf-mac Date: Sun, 21 Nov 2021 18:02:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=8A=A8=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/src/devtools/global.less | 8 ++++++++ source/src/devtools/ui/index.vue | 35 ++++++++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/source/src/devtools/global.less b/source/src/devtools/global.less index 0c014d0..5d7eb2b 100644 --- a/source/src/devtools/global.less +++ b/source/src/devtools/global.less @@ -16,6 +16,14 @@ background-color: #6d6d6d; } +.el-tree-node__content { + .leaf { + span { + user-select: none; + } + } +} + .el-input { input { text-align: left !important; diff --git a/source/src/devtools/ui/index.vue b/source/src/devtools/ui/index.vue index 95d57d7..550ad12 100644 --- a/source/src/devtools/ui/index.vue +++ b/source/src/devtools/ui/index.vue @@ -248,7 +248,7 @@ export default class Index extends Vue { treeData = [treeData] } this.treeData = treeData; - if (this.selectedUUID) { + if (this._checkSelectedUUID()) { this.$nextTick(() => { //@ts-ignore this.$refs.tree.setCurrentKey(this.selectedUUID); @@ -257,6 +257,36 @@ export default class Index extends Vue { } } + _checkSelectedUUID() { + if (this.selectedUUID) { + const b = this._findUuidInTree(this.treeData, this.selectedUUID) + if (b) { + return true; + } + } + this.selectedUUID = null; + this.treeItemData = null; + return false; + } + + _findUuidInTree(data: TreeData[], targetUUID: string) { + + function circle(tree: TreeData[]) { + for (let i = 0; i < tree.length; i++) { + let item: TreeData = tree[i]; + if (item.uuid === targetUUID) { + return true; + } + if (circle(item.children)) { + return true; + } + } + return false; + } + + return circle(data) + } + _onMsgNodeInfo(eventData: NodeInfoData) { this.isShowDebug = true; this.treeItemData = eventData; @@ -391,9 +421,6 @@ export default class Index extends Vue { this._clearTimer(); this.timerID = setInterval(() => { this.onBtnClickUpdateTree(); - if (this.selectedUUID) { - this.sendMsgToContentScript(Msg.NodeInfo, this.selectedUUID); - } }, time); } else { this._clearTimer();