mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-20 08:58:41 +00:00
保存刷新的配置
This commit is contained in:
parent
3c8c0e6e76
commit
033a1c209e
@ -48,10 +48,14 @@ export default defineComponent({
|
|||||||
const timer: Timer = new Timer();
|
const timer: Timer = new Timer();
|
||||||
timer.onWork = () => {
|
timer.onWork = () => {
|
||||||
freshAuto.value = true;
|
freshAuto.value = true;
|
||||||
|
config.value.refreshHirarchy = true;
|
||||||
|
appStore().save();
|
||||||
updateTree();
|
updateTree();
|
||||||
};
|
};
|
||||||
timer.onClean = () => {
|
timer.onClean = () => {
|
||||||
freshAuto.value = false;
|
freshAuto.value = false;
|
||||||
|
config.value.refreshHirarchy = false;
|
||||||
|
appStore().save();
|
||||||
};
|
};
|
||||||
timer.name = "hierarchy";
|
timer.name = "hierarchy";
|
||||||
let ins: MousetrapInstance | null = null;
|
let ins: MousetrapInstance | null = null;
|
||||||
@ -75,7 +79,11 @@ export default defineComponent({
|
|||||||
Bus.on(BusMsg.ChangeContent, changeContent);
|
Bus.on(BusMsg.ChangeContent, changeContent);
|
||||||
Bus.on(BusMsg.ShowPlace, funcShowPlace);
|
Bus.on(BusMsg.ShowPlace, funcShowPlace);
|
||||||
Bus.on(BusMsg.EnableSchedule, funcEnableSchedule);
|
Bus.on(BusMsg.EnableSchedule, funcEnableSchedule);
|
||||||
|
if (config.value.refreshHirarchy) {
|
||||||
timer.create(true);
|
timer.create(true);
|
||||||
|
} else {
|
||||||
|
updateTree();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
if (ins) {
|
if (ins) {
|
||||||
@ -164,7 +172,7 @@ export default defineComponent({
|
|||||||
selectedUUID = uuid;
|
selectedUUID = uuid;
|
||||||
Bus.emit(BusMsg.SelectNode, uuid);
|
Bus.emit(BusMsg.SelectNode, uuid);
|
||||||
}
|
}
|
||||||
const freshAuto = ref(false);
|
const freshAuto = ref(config.value.refreshHirarchy);
|
||||||
return {
|
return {
|
||||||
onClickRefresh() {
|
onClickRefresh() {
|
||||||
freshAuto.value = true;
|
freshAuto.value = true;
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import ccui from "@xuyanfeng/cc-ui";
|
import ccui from "@xuyanfeng/cc-ui";
|
||||||
import { IUiMenuItem } from "@xuyanfeng/cc-ui/types/cc-menu/const";
|
import { IUiMenuItem } from "@xuyanfeng/cc-ui/types/cc-menu/const";
|
||||||
|
import { storeToRefs } from "pinia";
|
||||||
import { defineComponent, onMounted, onUnmounted, ref } from "vue";
|
import { defineComponent, onMounted, onUnmounted, ref } from "vue";
|
||||||
import { Msg, PluginEvent, RequestNodeInfoData, ResponseSupportData } from "../../core/types";
|
import { Msg, PluginEvent, RequestNodeInfoData, ResponseSupportData } from "../../core/types";
|
||||||
import { ga } from "../../ga";
|
import { ga } from "../../ga";
|
||||||
@ -20,6 +21,7 @@ import { GA_EventName } from "../../ga/type";
|
|||||||
import { bridge } from "./bridge";
|
import { bridge } from "./bridge";
|
||||||
import { Bus, BusMsg } from "./bus";
|
import { Bus, BusMsg } from "./bus";
|
||||||
import { NodeInfoData } from "./data";
|
import { NodeInfoData } from "./data";
|
||||||
|
import { appStore } from "./store";
|
||||||
import { Timer } from "./timer";
|
import { Timer } from "./timer";
|
||||||
import Properties from "./ui/propertys.vue";
|
import Properties from "./ui/propertys.vue";
|
||||||
const { CCDock } = ccui.components;
|
const { CCDock } = ccui.components;
|
||||||
@ -34,13 +36,18 @@ export default defineComponent({
|
|||||||
treeItemData.value = null;
|
treeItemData.value = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const { config } = storeToRefs(appStore());
|
||||||
const timer = new Timer();
|
const timer = new Timer();
|
||||||
timer.onWork = () => {
|
timer.onWork = () => {
|
||||||
freshAuto.value = true;
|
freshAuto.value = true;
|
||||||
|
config.value.refreshInspector = true;
|
||||||
|
appStore().save();
|
||||||
updateNodeInfo();
|
updateNodeInfo();
|
||||||
};
|
};
|
||||||
timer.onClean = () => {
|
timer.onClean = () => {
|
||||||
freshAuto.value = false;
|
freshAuto.value = false;
|
||||||
|
config.value.refreshInspector = false;
|
||||||
|
appStore().save();
|
||||||
};
|
};
|
||||||
timer.name = "inspector";
|
timer.name = "inspector";
|
||||||
const treeItemData = ref<NodeInfoData | null>(null);
|
const treeItemData = ref<NodeInfoData | null>(null);
|
||||||
@ -65,7 +72,11 @@ export default defineComponent({
|
|||||||
Bus.on(BusMsg.ChangeContent, changeContent);
|
Bus.on(BusMsg.ChangeContent, changeContent);
|
||||||
Bus.on(BusMsg.SelectNode, funSelectNode);
|
Bus.on(BusMsg.SelectNode, funSelectNode);
|
||||||
Bus.on(BusMsg.EnableSchedule, funcEnableSchedule);
|
Bus.on(BusMsg.EnableSchedule, funcEnableSchedule);
|
||||||
|
if (config.value.refreshInspector) {
|
||||||
timer.create(true);
|
timer.create(true);
|
||||||
|
} else {
|
||||||
|
updateNodeInfo();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
Bus.off(BusMsg.ChangeContent, changeContent);
|
Bus.off(BusMsg.ChangeContent, changeContent);
|
||||||
@ -93,7 +104,7 @@ export default defineComponent({
|
|||||||
ccui.footbar.showError(error, { title: "parse property error" });
|
ccui.footbar.showError(error, { title: "parse property error" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const freshAuto = ref(false);
|
const freshAuto = ref(config.value.refreshInspector);
|
||||||
return {
|
return {
|
||||||
freshAuto,
|
freshAuto,
|
||||||
treeItemData,
|
treeItemData,
|
||||||
|
@ -20,6 +20,14 @@ export class ConfigData {
|
|||||||
* 展开测试的section
|
* 展开测试的section
|
||||||
*/
|
*/
|
||||||
expandTest: boolean = false;
|
expandTest: boolean = false;
|
||||||
|
/**
|
||||||
|
* 是否自动刷新inspector
|
||||||
|
*/
|
||||||
|
refreshInspector: boolean = true;
|
||||||
|
/**
|
||||||
|
* 是否自动刷新hierarchy
|
||||||
|
*/
|
||||||
|
refreshHirarchy: boolean = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const appStore = defineStore("app", () => {
|
export const appStore = defineStore("app", () => {
|
||||||
@ -43,6 +51,8 @@ export const appStore = defineStore("app", () => {
|
|||||||
config.value.refreshType = data.refreshType || RefreshType.Manual;
|
config.value.refreshType = data.refreshType || RefreshType.Manual;
|
||||||
config.value.refreshTime = data.refreshTime || 500;
|
config.value.refreshTime = data.refreshTime || 500;
|
||||||
config.value.expandTest = !!data.expandTest;
|
config.value.expandTest = !!data.expandTest;
|
||||||
|
config.value.refreshHirarchy = !!data.refreshHirarchy;
|
||||||
|
config.value.refreshInspector = !!data.refreshInspector;
|
||||||
},
|
},
|
||||||
save() {
|
save() {
|
||||||
const cfg = toRaw(config.value);
|
const cfg = toRaw(config.value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user