feat: page title i18n

This commit is contained in:
KUN1007 2023-10-13 22:58:21 +08:00
parent 4f8ef3b417
commit 233dd4a5d2
17 changed files with 84 additions and 25 deletions

View file

@ -276,6 +276,29 @@ export default {
rePwd: 'Confirm Password', rePwd: 'Confirm Password',
confirm: 'Confirm', confirm: 'Confirm',
}, },
// 路由标题
router: {
home: 'Home',
balance: 'P & L',
edit: 'Edit',
about: 'About',
userInfo: 'Info',
userSettings: 'Settings',
userPassword: 'Password',
userPublished: 'Published Topic',
userLiked: 'Liked Topic',
userUpvote: 'Upvote Topic',
userReply: 'Reply',
userComment: 'Comment',
nonMoe: 'Non-MoeMoe!',
pool: 'Pool',
ranking: 'Ranking',
regulations: 'Regulations',
technique: 'Technique',
thanks: 'Thinks List',
topics: 'Topics',
update: 'Update Log',
},
// 非页面组件这里统一用大驼峰 // 非页面组件这里统一用大驼峰
ComponentAlert: { ComponentAlert: {
confirm: 'OK', confirm: 'OK',

View file

@ -274,6 +274,29 @@ export default {
rePwd: '确认密码', rePwd: '确认密码',
confirm: '确定更改', confirm: '确定更改',
}, },
// 路由标题
router: {
home: '主页',
balance: '收支公示',
edit: '编辑',
about: '关于我们',
userInfo: '个人信息',
userSettings: '信息设置',
userPassword: '邮箱密码',
userPublished: '发的话题',
userLiked: '赞的话题',
userUpvote: '推的话题',
userReply: '发的回复',
userComment: '发的评论',
nonMoe: '不萌萌!',
pool: '话题池',
ranking: '排行榜',
regulations: '执行条例',
technique: '技术交流',
thanks: '感谢名单',
topics: '话题',
update: '更新日志',
},
// 非页面组件这里统一用大驼峰 // 非页面组件这里统一用大驼峰
ComponentAlert: { ComponentAlert: {
confirm: '确定', confirm: '确定',

View file

@ -1,9 +1,11 @@
import { Router } from 'vue-router' import { Router } from 'vue-router'
import { createPermission } from './permission' import { createPermission } from './permission'
import i18n from '@/language/i18n'
const createPageTitle = (router: Router) => { const createPageTitle = (router: Router) => {
router.beforeEach((to) => { router.beforeEach((to) => {
document.title = to.meta.title as string const title = to.meta.title as string
document.title = i18n.global.tm(`router.${title}`)
return true return true
}) })
} }

View file

@ -13,7 +13,7 @@ const balance: RouteRecordRaw[] = [
path: '', path: '',
component: () => import('@/views/balance/Balance.vue'), component: () => import('@/views/balance/Balance.vue'),
meta: { meta: {
title: '收支公示', title: 'balance',
}, },
}, },
], ],

View file

@ -13,7 +13,7 @@ const edit: RouteRecordRaw[] = [
path: '', path: '',
component: () => import('@/views/edit/Edit.vue'), component: () => import('@/views/edit/Edit.vue'),
meta: { meta: {
title: '编辑', title: 'edit',
}, },
}, },
], ],

View file

@ -14,7 +14,7 @@ const index: RouteRecordRaw[] = [
path: '', path: '',
component: () => import('@/views/Home/KUNGalgameMainPage.vue'), component: () => import('@/views/Home/KUNGalgameMainPage.vue'),
meta: { meta: {
title: '主页', title: 'home',
}, },
}, },
], ],

View file

@ -13,7 +13,7 @@ const kungalgame: RouteRecordRaw[] = [
path: '', path: '',
component: () => import('@/views/kungalgame/KUNGalgame.vue'), component: () => import('@/views/kungalgame/KUNGalgame.vue'),
meta: { meta: {
title: '关于我们', title: 'about',
}, },
}, },
], ],

View file

@ -23,7 +23,7 @@ const kungalgamer: RouteRecordRaw[] = [
path: 'info', path: 'info',
component: () => import('@/views/kungalgamer/content/Info.vue'), component: () => import('@/views/kungalgamer/content/Info.vue'),
meta: { meta: {
title: 'Info', title: 'userInfo',
}, },
}, },
{ {
@ -31,7 +31,7 @@ const kungalgamer: RouteRecordRaw[] = [
path: 'settings', path: 'settings',
component: () => import('@/views/kungalgamer/content/Settings.vue'), component: () => import('@/views/kungalgamer/content/Settings.vue'),
meta: { meta: {
title: 'Settings', title: 'userSettings',
permission: [4], permission: [4],
}, },
}, },
@ -40,7 +40,7 @@ const kungalgamer: RouteRecordRaw[] = [
path: 'password', path: 'password',
component: () => import('@/views/kungalgamer/content/Password.vue'), component: () => import('@/views/kungalgamer/content/Password.vue'),
meta: { meta: {
title: 'Password', title: 'userPassword',
permission: [4], permission: [4],
}, },
}, },
@ -50,7 +50,7 @@ const kungalgamer: RouteRecordRaw[] = [
path: 'published-topic', path: 'published-topic',
component: () => import('@/views/kungalgamer/content/Topic.vue'), component: () => import('@/views/kungalgamer/content/Topic.vue'),
meta: { meta: {
title: 'PublishedTopic', title: 'userPublished',
}, },
}, },
{ {
@ -59,7 +59,7 @@ const kungalgamer: RouteRecordRaw[] = [
path: 'liked-topic', path: 'liked-topic',
component: () => import('@/views/kungalgamer/content/Topic.vue'), component: () => import('@/views/kungalgamer/content/Topic.vue'),
meta: { meta: {
title: 'LikedTopic', title: 'userLiked',
permission: [2, 3, 4], permission: [2, 3, 4],
}, },
}, },
@ -69,7 +69,7 @@ const kungalgamer: RouteRecordRaw[] = [
path: 'upvote-topic', path: 'upvote-topic',
component: () => import('@/views/kungalgamer/content/Topic.vue'), component: () => import('@/views/kungalgamer/content/Topic.vue'),
meta: { meta: {
title: 'UpvoteTopic', title: 'userUpvote',
permission: [2, 3, 4], permission: [2, 3, 4],
}, },
}, },
@ -79,7 +79,7 @@ const kungalgamer: RouteRecordRaw[] = [
path: 'reply', path: 'reply',
component: () => import('@/views/kungalgamer/content/Topic.vue'), component: () => import('@/views/kungalgamer/content/Topic.vue'),
meta: { meta: {
title: 'Reply', title: 'userReply',
}, },
}, },
{ {
@ -88,7 +88,7 @@ const kungalgamer: RouteRecordRaw[] = [
path: 'comment', path: 'comment',
component: () => import('@/views/kungalgamer/content/Topic.vue'), component: () => import('@/views/kungalgamer/content/Topic.vue'),
meta: { meta: {
title: 'Comment', title: 'userComment',
}, },
}, },
], ],

View file

@ -13,7 +13,7 @@ const nonMoe: RouteRecordRaw[] = [
path: '', path: '',
component: () => import('@/views/non-moe/NonMoe.vue'), component: () => import('@/views/non-moe/NonMoe.vue'),
meta: { meta: {
title: '不萌萌', title: 'nonMoe',
}, },
}, },
], ],

View file

@ -13,7 +13,7 @@ const pool: RouteRecordRaw[] = [
path: '', path: '',
component: () => import('@/views/pool/Pool.vue'), component: () => import('@/views/pool/Pool.vue'),
meta: { meta: {
title: '话题池', title: 'pool',
}, },
}, },
], ],

View file

@ -13,7 +13,7 @@ const ranking: RouteRecordRaw[] = [
path: '', path: '',
component: () => import('@/views/ranking/Ranking.vue'), component: () => import('@/views/ranking/Ranking.vue'),
meta: { meta: {
title: '排行榜', title: 'ranking',
}, },
}, },
], ],

View file

@ -13,7 +13,7 @@ const bylaw: RouteRecordRaw[] = [
path: '', path: '',
component: () => import('@/views/bylaw/Bylaw.vue'), component: () => import('@/views/bylaw/Bylaw.vue'),
meta: { meta: {
title: '执行条例(试行)', title: 'regulations',
}, },
}, },
], ],

View file

@ -13,7 +13,7 @@ const technique: RouteRecordRaw[] = [
path: '', path: '',
component: () => import('@/views/technique/Technique.vue'), component: () => import('@/views/technique/Technique.vue'),
meta: { meta: {
title: '技术交流', title: 'technique',
}, },
}, },
], ],

View file

@ -13,7 +13,7 @@ const thanksList: RouteRecordRaw[] = [
path: '', path: '',
component: () => import('@/views/thanks-list/ThanksList.vue'), component: () => import('@/views/thanks-list/ThanksList.vue'),
meta: { meta: {
title: '感谢名单', title: 'thanks',
}, },
}, },
], ],

View file

@ -18,7 +18,7 @@ const topic: RouteRecordRaw[] = [
props: true, props: true,
meta: { meta: {
transition: 'animate__fadeIn animate__faster', transition: 'animate__fadeIn animate__faster',
title: '话题', title: 'topics',
}, },
}, },
], ],

View file

@ -13,7 +13,7 @@ const updateLog: RouteRecordRaw[] = [
path: '', path: '',
component: () => import('@/views/update-log/UpdateLog.vue'), component: () => import('@/views/update-log/UpdateLog.vue'),
meta: { meta: {
title: '更新日志', title: 'update',
}, },
}, },
], ],

View file

@ -128,10 +128,8 @@ const isSortField = () => {
font-size: 14px; font-size: 14px;
color: var(--kungalgame-font-color-3); color: var(--kungalgame-font-color-3);
text-decoration: none; text-decoration: none;
display: grid; display: flex;
grid-template-columns: repeat(2, minmax(0, 1fr)); justify-content: space-around;
grid-template-rows: repeat(1, minmax(0, 1fr));
place-items: center;
} }
/* 单个二级菜单 hover */ /* 单个二级菜单 hover */
.sort-item:hover { .sort-item:hover {
@ -178,4 +176,17 @@ const isSortField = () => {
color: var(--kungalgame-red-4); color: var(--kungalgame-red-4);
} }
} }
@media (max-width: 700px) {
.sort-item {
display: flex;
justify-content: center;
align-items: center;
span {
&:nth-child(1) {
display: none;
}
}
}
}
</style> </style>