修复多个tab标签下,devtool会错误展示content的问题

This commit is contained in:
xu_yanfeng
2025-01-08 16:38:43 +08:00
parent a20b913e37
commit 30e51657ae
9 changed files with 46 additions and 39 deletions

View File

@@ -109,6 +109,7 @@ export interface ObjectItemRequestData {
}
export interface FrameDetails {
tabID: number;
/**
* 网页的frameID
*/

View File

@@ -29,7 +29,7 @@ import { Option } from "@xuyanfeng/cc-ui/types/cc-select/const";
import { storeToRefs } from "pinia";
import { defineComponent, onMounted, onUnmounted, ref, toRaw } from "vue";
import PluginConfig from "../../../cc-plugin.config";
import { Msg, PluginEvent, RequestUseFrameData, ResponseSupportData } from "../../core/types";
import { Msg, PluginEvent, RequestUseFrameData, ResponseSupportData, ResponseUseFrameData } from "../../core/types";
import { bridge } from "./bridge";
import { Bus, BusMsg } from "./bus";
import { FrameDetails, NodeInfoData, TreeData } from "./data";
@@ -61,6 +61,9 @@ export default defineComponent({
checkSupport();
});
onMounted(() => {
ccui.footbar.showTipsArray({
tips: ["press space in the hierarchy to quickly control the display and hiding of nodes"],
});
Bus.on(BusMsg.EnableSchedule, funcEnableSchedule);
timer.create();
});
@@ -74,9 +77,7 @@ export default defineComponent({
const tabID = chrome.devtools.inspectedWindow.tabId;
chrome.scripting.executeScript({ files: ["js/execute.js"], target: { tabId: tabID } }, (results: chrome.scripting.InjectionResult[]) => {});
}
ccui.footbar.showTipsArray({
tips: ["press space in the hierarchy to quickly control the display and hiding of nodes"],
});
function _inspectedCode() {
let injectCode = "";
chrome.devtools.inspectedWindow.eval(injectCode, (result, isException) => {
@@ -103,6 +104,10 @@ export default defineComponent({
const isCocosGame: boolean = data.support;
isShowDebug.value = isCocosGame;
});
bridge.on(Msg.ResponseUseFrame, (event: PluginEvent) => {
const data: ResponseUseFrameData = event.data;
frameID.value = data.id;
});
bridge.on(Msg.ResponseNodeInfo, (event: PluginEvent) => {
let eventData: NodeInfoData = event.data;
isShowDebug.value = true;

View File

@@ -129,8 +129,8 @@ export default defineComponent({
},
onFrames() {
const data: FrameDetails[] = [
{ url: "url1", frameID: 1 },
{ url: "url2", frameID: 2 },
{ url: "url1", tabID: 1, frameID: 1 },
{ url: "url2", tabID: 1, frameID: 2 },
];
const event = new PluginEvent(Page.Background, Page.Devtools, Msg.ResponseUpdateFrames, data as ResponseUpdateFramesData);
testServer.send(event);