mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-06-03 06:44:00 +00:00
修复自动刷新的bug
This commit is contained in:
parent
fa8a3ab251
commit
8c0fe7e2bc
@ -16,6 +16,14 @@
|
||||
background-color: #6d6d6d;
|
||||
}
|
||||
|
||||
.el-tree-node__content {
|
||||
.leaf {
|
||||
span {
|
||||
user-select: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.el-input {
|
||||
input {
|
||||
text-align: left !important;
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user