Files
ruoyi-plus-vben5/apps/web-antd/src/app.vue
dap ba65f750d4 feat(全局): 添加全局弹窗上下文组件并声明类型
添加 PopupContext 组件用于全局提供 message、modal 和 notification 方法
在 global.d.ts 中声明对应的 window 类型
将 analytics 页面的 notification 调用改为使用全局方法
2026-01-14 15:45:39 +08:00

56 lines
1.1 KiB
Vue

<script lang="ts" setup>
import { computed } from 'vue';
import { useAntdDesignTokens } from '@vben/hooks';
import { preferences, usePreferences } from '@vben/preferences';
import { App, ConfigProvider, theme } from 'antdv-next';
import { antdLocale } from '#/locales';
import { useUploadTip } from './upload-tip';
import { PopupContext } from './utils/context';
defineOptions({ name: 'App' });
const { isDark } = usePreferences();
const { tokens } = useAntdDesignTokens();
const tokenTheme = computed(() => {
const algorithm = isDark.value
? [theme.darkAlgorithm]
: [theme.defaultAlgorithm];
// antd 紧凑模式算法
if (preferences.app.compact) {
algorithm.push(theme.compactAlgorithm);
}
return {
algorithm,
token: tokens,
};
});
useUploadTip();
</script>
<template>
<ConfigProvider :locale="antdLocale" :theme="tokenTheme" variant="outlined">
<App>
<RouterView />
<PopupContext />
</App>
</ConfigProvider>
</template>
<style lang="scss">
body {
/**
* 全局启用 抗锯齿字体
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/font-smooth
*/
@apply antialiased;
}
</style>