Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
bigwood
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
罗超
bigwood
Commits
b410c9e7
Commit
b410c9e7
authored
Nov 02, 2022
by
youjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
f1f10443
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
5 deletions
+21
-5
index.ts
src/i18n/index.ts
+3
-1
login.vue
src/pages/auth/login.vue
+9
-3
tools.ts
src/utils/tools.ts
+9
-1
No files found.
src/i18n/index.ts
View file @
b410c9e7
import
enUS
from
'./en-US'
import
enUS
from
'./en-US'
import
zhTW
from
'./zh-TW'
import
zhTW
from
'./zh-TW'
import
zhSW
from
'./zh-SW'
export
default
{
export
default
{
'en-US'
:
enUS
,
'en-US'
:
enUS
,
'zh-TW'
:
zhTW
'zh-TW'
:
zhTW
,
'zh-SW'
:
zhSW
,
}
}
src/pages/auth/login.vue
View file @
b410c9e7
...
@@ -97,6 +97,7 @@
...
@@ -97,6 +97,7 @@
option-value=
"langLocale"
option-value=
"langLocale"
option-label=
"langName"
option-label=
"langName"
style=
"width:180px"
style=
"width:180px"
@
update:model-value=
"getLanguage"
>
>
<template
v-slot:selected
>
<template
v-slot:selected
>
{{
$t
(
"lanuage"
)
}}
:
{{
$t
(
"lanuage"
)
}}
:
...
@@ -119,12 +120,12 @@
...
@@ -119,12 +120,12 @@
</template>
</template>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
defineComponent
,
reactive
}
from
'vue'
import
{
defineComponent
,
reactive
,
ref
}
from
'vue'
import
useLgoinModule
from
'../../module/user/loginModule'
import
useLgoinModule
from
'../../module/user/loginModule'
import
useMetaModule
from
'../../module/meta/metaModule'
import
useMetaModule
from
'../../module/meta/metaModule'
import
{
useI18n
}
from
'vue-i18n'
import
{
useI18n
}
from
'vue-i18n'
import
{
getLangs
}
from
"../../utils/tools"
;
import
{
getLangs
}
from
"../../utils/tools"
;
import
{
SitLang
}
from
'../../@types
/index
'
;
import
{
SitLang
}
from
'../../@types'
;
import
{
ref
}
from
'vue'
;
import
{
ref
}
from
'vue'
;
export
default
defineComponent
({
export
default
defineComponent
({
setup
()
{
setup
()
{
...
@@ -143,8 +144,13 @@ export default defineComponent({
...
@@ -143,8 +144,13 @@ export default defineComponent({
if
(
data
.
langs
&&
data
.
langs
.
length
>
0
){
if
(
data
.
langs
&&
data
.
langs
.
length
>
0
){
data
.
currentLang
=
data
.
langs
.
find
(
x
=>
x
.
langLocale
==
locale
.
value
)
??
{};
data
.
currentLang
=
data
.
langs
.
find
(
x
=>
x
.
langLocale
==
locale
.
value
)
??
{};
}
}
// 切换语言
const
getLanguage
=
(
val
)
=>
{
locale
.
value
=
val
.
langLocale
;
}
return
{
userModel
,
usernameRef
,
passwordRef
,
userValidateRule
,
loginSubmit
,
dtNow
,
stateManager
,...
data
}
return
{
userModel
,
usernameRef
,
passwordRef
,
userValidateRule
,
loginSubmit
,
dtNow
,
stateManager
,
getLanguage
,
...
data
}
}
}
})
})
</
script
>
</
script
>
...
...
src/utils/tools.ts
View file @
b410c9e7
...
@@ -36,7 +36,15 @@ export function getLangs() {
...
@@ -36,7 +36,15 @@ export function getLangs() {
langLocale
:
"zh-TW"
,
langLocale
:
"zh-TW"
,
langName
:
"中文繁体"
langName
:
"中文繁体"
}
}
const
zhSw
:
SitLang
=
{
langLocale
:
"zh-SW"
,
langName
:
"中文简体"
}
const
enUs
:
SitLang
=
{
langLocale
:
"en-US"
,
langName
:
"English"
}
let
langs
:
SitLang
[]
=
[]
let
langs
:
SitLang
[]
=
[]
langs
.
push
(
zhTw
);
langs
.
push
(
zhTw
,
zhSw
,
enUs
);
return
langs
return
langs
}
}
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