Files
iot-device-management-frontend/apps/web-tdesign/src/app.vue

37 lines
903 B
Vue
Raw Normal View History

2025-10-21 10:47:39 +08:00
<script lang="ts" setup>
2025-11-06 23:02:24 +08:00
import type { GlobalConfigProvider } from 'tdesign-vue-next';
2025-10-21 10:47:39 +08:00
import { watch } from 'vue';
2025-10-21 10:47:39 +08:00
2025-11-06 23:02:24 +08:00
import { usePreferences } from '@vben/preferences';
import { merge } from 'es-toolkit/compat';
import { ConfigProvider } from 'tdesign-vue-next';
2025-11-06 23:02:24 +08:00
import zhConfig from 'tdesign-vue-next/es/locale/zh_CN';
2025-10-21 10:47:39 +08:00
defineOptions({ name: 'App' });
const { isDark } = usePreferences();
watch(
() => isDark.value,
(dark) => {
document.documentElement.setAttribute('theme-mode', dark ? 'dark' : '');
},
{ immediate: true },
);
2025-10-21 10:47:39 +08:00
2025-11-06 23:02:24 +08:00
const customConfig: GlobalConfigProvider = {
2025-10-22 18:14:42 +08:00
// 可以在此处定义更多自定义配置,具体可配置内容参看 API 文档
calendar: {},
table: {},
pagination: {},
2025-11-06 23:02:24 +08:00
};
const globalConfig = merge(zhConfig, customConfig);
2025-10-21 10:47:39 +08:00
</script>
<template>
2025-10-22 18:14:42 +08:00
<ConfigProvider :global-config="globalConfig">
2025-11-06 23:02:24 +08:00
<RouterView />
2025-10-21 10:47:39 +08:00
</ConfigProvider>
</template>