Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
admin-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pleroma
admin-fe
Commits
fbb36414
Commit
fbb36414
authored
6 years ago
by
Pan
Browse files
Options
Downloads
Patches
Plain Diff
refine i18n demo
parent
f85b044f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/views/i18n-demo/index.vue
+34
-9
34 additions, 9 deletions
src/views/i18n-demo/index.vue
src/views/i18n-demo/local.js
+10
-3
10 additions, 3 deletions
src/views/i18n-demo/local.js
with
44 additions
and
12 deletions
src/views/i18n-demo/index.vue
+
34
−
9
View file @
fbb36414
...
...
@@ -20,13 +20,13 @@
<el-date-picker
v-model=
"date"
:placeholder=
"$t('i18nView.datePlaceholder')"
type=
"date"
/>
</div>
<div
class=
"block"
>
<el-
pagination
:current-page=
"currentPage"
:page-sizes=
"[100, 200, 300, 400]
"
:page-size=
"100
"
:total=
"400
"
background
layout=
"total, sizes, prev, pager, next"
/
>
<el-
select
v-model=
"value"
:placeholder=
"$t('i18nView.selectPlaceholder')"
>
<el-option
v-for=
"item in options
"
:key=
"item.value
"
:label=
"item.label
"
:value=
"item.value"
/>
</el-select
>
</div>
<div
class=
"block"
>
<el-button
class=
"item-btn"
size=
"small"
>
{{
$t
(
'
i18nView.default
'
)
}}
</el-button>
...
...
@@ -57,7 +57,6 @@ export default {
data
()
{
return
{
date
:
''
,
currentPage
:
5
,
tableData
:
[{
date
:
'
2016-05-03
'
,
name
:
'
Tom
'
,
...
...
@@ -77,7 +76,9 @@ export default {
date
:
'
2016-05-01
'
,
name
:
'
Tom
'
,
address
:
'
No. 189, Grove St, Los Angeles
'
}]
}],
options
:
[],
value
:
''
}
},
computed
:
{
...
...
@@ -91,11 +92,35 @@ export default {
}
}
},
watch
:
{
lang
()
{
this
.
setOptions
()
}
},
created
()
{
if
(
!
this
.
$i18n
.
getLocaleMessage
(
'
en
'
)[
viewName
])
{
this
.
$i18n
.
mergeLocaleMessage
(
'
en
'
,
local
.
en
)
this
.
$i18n
.
mergeLocaleMessage
(
'
zh
'
,
local
.
zh
)
}
this
.
setOptions
()
// set default select options
},
methods
:
{
setOptions
()
{
this
.
options
=
[
{
value
:
'
1
'
,
label
:
this
.
$t
(
'
i18nView.one
'
)
},
{
value
:
'
2
'
,
label
:
this
.
$t
(
'
i18nView.two
'
)
},
{
value
:
'
3
'
,
label
:
this
.
$t
(
'
i18nView.three
'
)
}
]
}
}
}
</
script
>
...
...
This diff is collapsed.
Click to expand it.
src/views/i18n-demo/local.js
+
10
−
3
View file @
fbb36414
...
...
@@ -5,6 +5,7 @@ export default {
title
:
'
切换语言
'
,
note
:
'
本项目国际化基于 vue-i18n
'
,
datePlaceholder
:
'
请选择日期
'
,
selectPlaceholder
:
'
请选择
'
,
tableDate
:
'
日期
'
,
tableName
:
'
姓名
'
,
tableAddress
:
'
地址
'
,
...
...
@@ -13,15 +14,18 @@ export default {
success
:
'
成功按钮
'
,
info
:
'
信息按钮
'
,
warning
:
'
警告按钮
'
,
danger
:
'
危险按钮
'
danger
:
'
危险按钮
'
,
one
:
'
一
'
,
two
:
'
二
'
,
three
:
'
三
'
}
},
en
:
{
i18nView
:
{
title
:
'
Switch Language
'
,
note
:
'
The internationalization of this project is based on vue-i18n
'
,
datePlaceholder
:
'
Pick a day
'
,
selectPlaceholder
:
'
Select
'
,
tableDate
:
'
tableDate
'
,
tableName
:
'
tableName
'
,
tableAddress
:
'
tableAddress
'
,
...
...
@@ -30,7 +34,10 @@ export default {
success
:
'
success
'
,
info
:
'
info
'
,
warning
:
'
warning
'
,
danger
:
'
danger
'
danger
:
'
danger
'
,
one
:
'
One
'
,
two
:
'
Two
'
,
three
:
'
Three
'
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment