fix(App): 调整 Toast 组件 z-index 并优化国际化缺失提示
Some checks failed
CI/CD Pipeline / build-and-deploy (push) Has been cancelled
CI/CD Pipeline / playwright (push) Has been cancelled

- 为 Toast 组件添加 style="z-index: 5000" 以确保其层级高于其他 UI 元素
- 在开发模式下,当菜单翻译缺失时,通过 ToastService 弹出警告提示
- 更新 app-config 插件中的 __DEV__ 注释,明确其来源于 vite.config.ts 的 define 配置
- 提高 PrimeVue 的 zIndex 配置值,避免与自定义组件层级冲突
This commit is contained in:
严浩
2025-11-05 23:23:28 +08:00
parent fd0543dcc2
commit 290aed74f2
4 changed files with 15 additions and 6 deletions

View File

@@ -6,7 +6,7 @@ import AppNaiveUIProvider from './AppNaiveUIProvider.vue';
<template>
<DynamicDialog />
<ConfirmDialog />
<Toast />
<Toast style="z-index: 5000" />
<AppNaiveUIProvider>
<router-view v-slot="{ Component }">

View File

@@ -36,6 +36,14 @@ export const routeI18nInstance = createI18n({
useScope: 'local',
missing: (locale, key) => {
consola.warn(`菜单翻译缺失: locale=${locale}, key=${key}`);
if (__DEV__) {
ToastService.add({
severity: 'warn',
summary: '菜单翻译缺失',
detail: "缺少菜单国际化内容: locale='A', key='B'",
life: 5000,
});
}
return key;
},
fallbackRoot: true,

View File

@@ -1,5 +1,6 @@
export function install({ app }: { app: import('vue').App<Element> }) {
app.config.globalProperties.__DEV__ = __DEV__;
app.config.globalProperties.__DEV__ =
__DEV__; /* vite.config.ts: define: { __DEV__: JSON.stringify(!isBuild) } */
app.config.errorHandler = (error, instance, info) => {
console.error('Global error:', error);

View File

@@ -15,10 +15,10 @@ export function install({ app }: { app: import('vue').App<Element> }) {
// https://github.com/primefaces/primevue/blob/afe6f58ae55e9caf7f9bc094cd453a21a6113001/packages/core/src/config/PrimeVue.js
app.use(PrimeVue, {
zIndex: {
modal: 2100,
overlay: 2000,
menu: 2000,
tooltip: 2100,
modal: 5100,
overlay: 5000,
menu: 5000,
tooltip: 5100,
},
locale: {
...zhCN['zh-CN'],