fix(types): 路由守卫修正

This commit is contained in:
黄磊 2025-02-27 04:29:14 -05:00
parent 99745ad9fa
commit b42db2ad9e
5 changed files with 12 additions and 1 deletions

View File

@ -1,4 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { useRoute } from 'vue-router';
import { computed } from 'vue';
import { $t } from '@/locales'; import { $t } from '@/locales';
defineOptions({ defineOptions({
@ -10,6 +12,11 @@ interface Props {
showTitle?: boolean; showTitle?: boolean;
} }
const route = useRoute();
const title = computed(() => {
return route.meta.pageType === 'pan' ? $t('system.panTitle') : $t('system.title');
});
withDefaults(defineProps<Props>(), { withDefaults(defineProps<Props>(), {
showTitle: true showTitle: true
}); });
@ -19,7 +26,7 @@ withDefaults(defineProps<Props>(), {
<RouterLink to="/" class="w-full flex-center nowrap-hidden"> <RouterLink to="/" class="w-full flex-center nowrap-hidden">
<SystemLogo class="text-32px text-primary" /> <SystemLogo class="text-32px text-primary" />
<h2 v-show="showTitle" class="pl-8px text-16px text-primary font-bold transition duration-300 ease-in-out"> <h2 v-show="showTitle" class="pl-8px text-16px text-primary font-bold transition duration-300 ease-in-out">
{{ $t('system.title') }} {{ $t(title) }}
</h2> </h2>
</RouterLink> </RouterLink>
</template> </template>

View File

@ -1,6 +1,7 @@
const local: App.I18n.Schema = { const local: App.I18n.Schema = {
system: { system: {
title: 'SoybeanAdmin', title: 'SoybeanAdmin',
panTitle: 'Tricolor Netdisk',
updateTitle: 'System Version Update Notification', updateTitle: 'System Version Update Notification',
updateContent: 'A new version of the system has been detected. Do you want to refresh the page immediately?', updateContent: 'A new version of the system has been detected. Do you want to refresh the page immediately?',
updateConfirm: 'Refresh immediately', updateConfirm: 'Refresh immediately',

View File

@ -1,6 +1,7 @@
const local: App.I18n.Schema = { const local: App.I18n.Schema = {
system: { system: {
title: 'Soybean 管理系统', title: 'Soybean 管理系统',
panTitle: '淳享网盘NB版',
updateTitle: '系统版本更新通知', updateTitle: '系统版本更新通知',
updateContent: '检测到系统有新版本发布,是否立即刷新页面?', updateContent: '检测到系统有新版本发布,是否立即刷新页面?',
updateConfirm: '立即刷新', updateConfirm: '立即刷新',

View File

@ -83,6 +83,7 @@ export const generatedRoutes: GeneratedRoute[] = [
meta: { meta: {
title: 'pan', title: 'pan',
i18nKey: 'route.pan', i18nKey: 'route.pan',
icon: 'lineicons:folder',
pageType: 'pan' pageType: 'pan'
} }
} }

View File

@ -290,6 +290,7 @@ declare namespace App {
type Schema = { type Schema = {
system: { system: {
title: string; title: string;
panTitle: string;
updateTitle: string; updateTitle: string;
updateContent: string; updateContent: string;
updateConfirm: string; updateConfirm: string;