Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
dev
/
pingan-life-index-pro
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
0ba95efe
authored
2020-06-05 17:00:01 +0800
by
simon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.切换语言时切换标题
1 parent
5da175cf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
src/main.js
src/router.js
src/main.js
View file @
0ba95ef
...
...
@@ -80,7 +80,7 @@ let vueInstance = new Vue({
// queryConfigData: localStorage.getItem("queryConfig") || null, // 2.放localStorage
}
}).
$mount
(
'#app'
);
//
window.vueInstance = vueInstance; // 实在不满足需要,可以把vue实例挂载到windows上
window
.
vueInstance
=
vueInstance
;
// 实在不满足需要,可以把vue实例挂载到windows上
/**
* 初始化请求配置
...
...
src/router.js
View file @
0ba95ef
...
...
@@ -313,10 +313,12 @@ const router = new Router({
});
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
function
setTitleByRouter
(
to
){
let
langStr
=
localStorage
.
getItem
(
"lang"
)
||
'tc'
;
let
lang
;
// switch
let
defaultTitle
=
"中国平安人寿(香港)"
;
switch
(
langStr
)
{
// 简体
...
...
@@ -356,6 +358,11 @@ router.beforeEach((to, from, next) => {
}
document
.
title
=
title
;
}
}
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
setTitleByRouter
(
to
);
// const scrollTopList = [
// "newsList", "newsDetail", "protocol", "privacy", "terms", "paymentType", "reservation"
// ]
...
...
@@ -365,3 +372,13 @@ router.beforeEach((to, from, next) => {
});
export
default
router
;
function
initEvt
()
{
window
.
vueInstance
.
eventBus
.
$on
(
"langChange"
,
()
=>
{
setTitleByRouter
(
window
.
vueInstance
.
_route
)
});
}
setTimeout
(()
=>
{
initEvt
();
},
0
);
\ No newline at end of file
...
...
Please
register
or
sign in
to post a comment