- 为 Toast 组件添加 style="z-index: 5000" 以确保其层级高于其他 UI 元素 - 在开发模式下,当菜单翻译缺失时,通过 ToastService 弹出警告提示 - 更新 app-config 插件中的 __DEV__ 注释,明确其来源于 vite.config.ts 的 define 配置 - 提高 PrimeVue 的 zIndex 配置值,避免与自定义组件层级冲突
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
/**
|
|
* 需要把 <DynamicDialog /> <ConfirmDialog /> <Toast /> 放在 App.vue 的 template 中
|
|
*/
|
|
|
|
import Aura from '@primeuix/themes/aura';
|
|
import zhCN from 'primelocale/zh-CN.json';
|
|
import PrimeVue from 'primevue/config';
|
|
import type { PrimeVueConfiguration } from 'primevue/config';
|
|
import StyleClass from 'primevue/styleclass';
|
|
import ToastService from 'primevue/toastservice';
|
|
|
|
export function install({ app }: { app: import('vue').App<Element> }) {
|
|
app.directive('styleclass', StyleClass);
|
|
|
|
// https://github.com/primefaces/primevue/blob/afe6f58ae55e9caf7f9bc094cd453a21a6113001/packages/core/src/config/PrimeVue.js
|
|
app.use(PrimeVue, {
|
|
zIndex: {
|
|
modal: 5100,
|
|
overlay: 5000,
|
|
menu: 5000,
|
|
tooltip: 5100,
|
|
},
|
|
locale: {
|
|
...zhCN['zh-CN'],
|
|
completed: '已上传',
|
|
noFileChosenMessage: '未选择文件',
|
|
pending: '待上传',
|
|
}, // usePrimeVue().config.locale
|
|
theme: {
|
|
options: {
|
|
cssLayer: false,
|
|
darkModeSelector: '.app-dark' /* 'system' */,
|
|
prefix: 'p',
|
|
},
|
|
preset: Aura,
|
|
},
|
|
} satisfies PrimeVueConfiguration);
|
|
app.use(ToastService);
|
|
}
|