diff --git a/core/App.vue b/core/App.vue index 6370264..c968698 100644 --- a/core/App.vue +++ b/core/App.vue @@ -23,6 +23,13 @@ const props = withDefaults(defineProps(), { const getAppFunc = inject('getAppFunc', (arg: {name: string, func: Function}):void => {}); const dataSource = ref<{[key: string]: any}>(); +// Theme management +const currentTheme = ref<'light' | 'dark'>('light'); +const toggleTheme = () => { + currentTheme.value = currentTheme.value === 'light' ? 'dark' : 'light'; + document.documentElement.setAttribute('data-theme', currentTheme.value); +}; + const DocInfo = defineAsyncComponent(() => import('./docInfo/formView/index.vue')); @@ -35,7 +42,7 @@ const Comp = defineAsyncComponent(() => import('./component/index.vue')); const ApiModel = defineAsyncComponent(() => import('./component/apisModel/index.vue')); const PathInfo = defineAsyncComponent(() => import('./pathInfo/index.vue')); -const DocInfoPreview = defineAsyncComponent(() => import('./docInfo/preview/index.vue')); +const DocInfoPreview = defineAsyncComponent(() => import('./docInfo/preView/index.vue')); const ExternalDocPreview = defineAsyncComponent(() => import('./externalDoc/preView/index.vue')); const ServerPreview = defineAsyncComponent(() => import('./server/preView/index.vue')); const SecurityPreview = defineAsyncComponent(() => import('./security/preView/index.vue')); @@ -211,6 +218,8 @@ onMounted(() => { }}); getAppFunc({name: 'changeLanguage', func: handleChangeLanguage }); + + getAppFunc({name: 'toggleTheme', func: toggleTheme }); watch(() => showPreview.value, (newValue) => { if (!newValue) { @@ -258,8 +267,8 @@ provide('language', language); diff --git a/core/extensions/formView/index.vue b/core/extensions/formView/index.vue index 66ed1ff..a22b4dd 100644 --- a/core/extensions/formView/index.vue +++ b/core/extensions/formView/index.vue @@ -170,7 +170,7 @@ defineExpose({ @blur="changeSelectExtensionValue($event, selectedExtension.name)" />
- +
diff --git a/core/security/preView/index.vue b/core/security/preView/index.vue index dab8552..b88ae47 100644 --- a/core/security/preView/index.vue +++ b/core/security/preView/index.vue @@ -1,7 +1,7 @@