From f667ffbfddb917dca74636c10f94679f2b1df4ab Mon Sep 17 00:00:00 2001 From: Kevin Luo Date: Wed, 18 Dec 2024 23:23:22 -0500 Subject: [PATCH 1/5] move up the toggle app region --- .../applet/src/modules/components/index.vue | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/packages/applet/src/modules/components/index.vue b/packages/applet/src/modules/components/index.vue index 865540304..b5a0a7672 100644 --- a/packages/applet/src/modules/components/index.vue +++ b/packages/applet/src/modules/components/index.vue @@ -215,6 +215,30 @@ onUnmounted(() => { rpc.functions.off(DevToolsMessagingEvents.INSPECTOR_TREE_UPDATED, onInspectorTreeUpdated) }) +// #region toggle app +const devtoolsState = useDevToolsState() +const appRecords = computed(() => devtoolsState.appRecords.value.map(app => ({ + label: app.name + (app.version ? ` (${app.version})` : ''), + value: app.id, +}))) + +const normalizedAppRecords = computed(() => appRecords.value.map(app => ({ + label: app.label, + id: app.value, +}))) + +const activeAppRecordId = ref(devtoolsState.activeAppRecordId.value) +watchEffect(() => { + activeAppRecordId.value = devtoolsState.activeAppRecordId.value +}) + +async function toggleApp(id: string) { + await rpc.value.toggleApp(id) + activeComponentId.value = '' + await getComponentsInspectorTree() +} +// #endregion + function inspectComponentInspector() { inspectComponentTipVisible.value = true emit('onInspectComponentStart') @@ -280,32 +304,6 @@ function closeComponentRenderCode() { componentRenderCode.value = '' componentRenderCodeVisible.value = false } - -// #region toggle app -const devtoolsState = useDevToolsState() -const appRecords = computed(() => devtoolsState.appRecords.value.map(app => ({ - label: app.name + (app.version ? ` (${app.version})` : ''), - value: app.id, -}))) - -const normalizedAppRecords = computed(() => appRecords.value.map(app => ({ - label: app.label, - id: app.value, -}))) - -const activeAppRecordId = ref(devtoolsState.activeAppRecordId.value) -watchEffect(() => { - activeAppRecordId.value = devtoolsState.activeAppRecordId.value -}) - -function toggleApp(id: string) { - rpc.value.toggleApp(id).then(() => { - activeComponentId.value = '' - getComponentsInspectorTree() - }) -} - -// #endregion