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();