Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
b215f71d
Commit
b215f71d
authored
Nov 11, 2016
by
FuryBean
Committed by
cinwell.li
Nov 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve example lang. (#990)
parent
63d68f8f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
examples/components/header.vue
examples/components/header.vue
+1
-0
examples/route.config.js
examples/route.config.js
+8
-2
No files found.
examples/components/header.vue
View file @
b215f71d
...
...
@@ -200,6 +200,7 @@
methods
:
{
switchLang
(
targetLang
)
{
if
(
this
.
lang
===
targetLang
)
return
;
localStorage
.
setItem
(
'
ELEMENT_LANGUAGE
'
,
targetLang
);
this
.
$router
.
push
(
this
.
$route
.
path
.
replace
(
this
.
lang
,
targetLang
));
}
},
...
...
examples/route.config.js
View file @
b215f71d
...
...
@@ -85,12 +85,18 @@ langs.forEach(lang => {
route
=
route
.
concat
(
generateMiscRoutes
(
lang
.
lang
));
});
let
userLanguage
=
localStorage
.
getItem
(
'
ELEMENT_LANGUAGE
'
)
||
window
.
navigator
.
language
;
let
defaultPath
=
'
/en-US
'
;
if
(
userLanguage
.
indexOf
(
'
zh-
'
)
!==
-
1
)
{
defaultPath
=
'
/zh-CN
'
;
}
route
=
route
.
concat
([{
path
:
'
/
'
,
redirect
:
'
/zh-CN
'
redirect
:
defaultPath
},
{
path
:
'
*
'
,
redirect
:
'
/zh-CN
'
redirect
:
defaultPath
}]);
export
default
route
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment