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 1
1
<script setup lang="ts">
2
+ import { useI18n } from ' vue-i18n'
2
3
import { useRouteCacheStore } from ' @/stores'
3
4
5
+ const { t } = useI18n ()
6
+
4
7
useHead ({
5
- title: ' Vue3 Vant Mobile ' ,
8
+ title : () => t ( ' app.name ' ) ,
6
9
meta: [
7
10
{
8
11
name: ' description' ,
9
- content: ' An mobile web apps template based on the Vue 3 ecosystem ' ,
12
+ content : () => t ( ' app.description ' ) ,
10
13
},
11
14
{
12
15
name: ' theme-color' ,
13
- content : () => isDark .value ? ' #00aba9 ' : ' #ffffff' ,
16
+ content : () => isDark .value ? ' #0B0A0A ' : ' #ffffff' ,
14
17
},
15
18
],
16
19
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 1
1
{
2
+ "app" : {
3
+ "name" : " Vue3 Vant Mobile" ,
4
+ "description" : " An mobile web apps template based on the Vue 3 ecosystem"
5
+ },
6
+
2
7
"navbar" : {
3
8
"Home" : " Home" ,
4
9
"Profile" : " Profile" ,
Original file line number Diff line number Diff line change 1
1
{
2
+ "app" : {
3
+ "name" : " Vue3 移动端模板" ,
4
+ "description" : " 一个基于 Vue 3 生态系统的移动 web 应用模板"
5
+ },
6
+
2
7
"navbar" : {
3
8
"Home" : " 主页" ,
4
9
"Profile" : " 我的" ,
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ router.beforeEach(async (to: EnhancedRouteLocation) => {
31
31
routeCacheStore . addRoute ( to )
32
32
33
33
// Set page title
34
- setPageTitle ( to . meta . title )
34
+ setPageTitle ( to . name )
35
35
36
36
if ( isLogin ( ) && ! userStore . userInfo ?. uid )
37
37
await userStore . info ( )
Original file line number Diff line number Diff line change 1
1
import { appName } from '@/constants'
2
+ import { i18n } from '@/utils/i18n'
2
3
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 ( )
5
6
}
You can’t perform that action at this time.
0 commit comments