修复自动刷新的bug

This commit is contained in:
xyf-mac 2021-11-21 18:02:23 +08:00
parent fa8a3ab251
commit 8c0fe7e2bc
2 changed files with 39 additions and 4 deletions

View File

@ -16,6 +16,14 @@
background-color: #6d6d6d;
}
.el-tree-node__content {
.leaf {
span {
user-select: none;
}
}
}
.el-input {
input {
text-align: left !important;

View File

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