File tree Expand file tree Collapse file tree 6 files changed +24
-8
lines changed Expand file tree Collapse file tree 6 files changed +24
-8
lines changed Original file line number Diff line number Diff line change 11<script setup lang="ts">
2+ import { useI18n } from ' vue-i18n'
23import { useRouteCacheStore } from ' @/stores'
34
5+ const { t } = useI18n ()
6+
47useHead ({
5- title: ' Vue3 Vant Mobile ' ,
8+ title : () => t ( ' app.name ' ) ,
69 meta: [
710 {
811 name: ' description' ,
9- content: ' An mobile web apps template based on the Vue 3 ecosystem ' ,
12+ content : () => t ( ' app.description ' ) ,
1013 },
1114 {
1215 name: ' theme-color' ,
13- content : () => isDark .value ? ' #00aba9 ' : ' #ffffff' ,
16+ content : () => isDark .value ? ' #0B0A0A ' : ' #ffffff' ,
1417 },
1518 ],
1619 link: [
Original file line number Diff line number Diff line change 1- export const appName = 'vue3-vant-mobile'
2- export const appDescription = 'An mobile web apps template based on the Vue 3 ecosystem'
1+ import { i18n } from '@/utils/i18n'
2+
3+ export const appName = ( ) => i18n . global . t ( 'app.name' )
4+ export const appDescription = ( ) => i18n . global . t ( 'app.description' )
Original file line number Diff line number Diff line change 11{
2+ "app" : {
3+ "name" : " Vue3 Vant Mobile" ,
4+ "description" : " An mobile web apps template based on the Vue 3 ecosystem"
5+ },
6+
27 "navbar" : {
38 "Home" : " Home" ,
49 "Profile" : " Profile" ,
Original file line number Diff line number Diff line change 11{
2+ "app" : {
3+ "name" : " Vue3 移动端模板" ,
4+ "description" : " 一个基于 Vue 3 生态系统的移动 web 应用模板"
5+ },
6+
27 "navbar" : {
38 "Home" : " 主页" ,
49 "Profile" : " 我的" ,
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ router.beforeEach(async (to: EnhancedRouteLocation) => {
3131 routeCacheStore . addRoute ( to )
3232
3333 // Set page title
34- setPageTitle ( to . meta . title )
34+ setPageTitle ( to . name )
3535
3636 if ( isLogin ( ) && ! userStore . userInfo ?. uid )
3737 await userStore . info ( )
Original file line number Diff line number Diff line change 11import { appName } from '@/constants'
2+ import { i18n } from '@/utils/i18n'
23
3- export default function setPageTitle ( title ?: string ) : void {
4- window . document . title = title ? `${ title } - ${ appName } ` : appName
4+ export default function setPageTitle ( name ?: string ) : void {
5+ window . document . title = name ? `${ i18n . global . t ( `navbar. ${ name } ` ) } - ${ appName ( ) } ` : appName ( )
56}
You can’t perform that action at this time.
0 commit comments