Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-fe
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
poc
poc-fe
Commits
5242c5cb
Commit
5242c5cb
authored
Nov 14, 2024
by
tyyin lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 组件库多语言配置
parent
5270fd70
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
3 deletions
+31
-3
app.vue
src/app.vue
+31
-3
No files found.
src/app.vue
View file @
5242c5cb
<
script
setup
lang=
"ts"
>
import
{
zhCN
,
dateZhCN
}
from
'naive-ui'
import
{
zhCN
,
dateZhCN
,
zhTW
,
dateZhTW
,
enUS
,
dateEnUS
}
from
'naive-ui'
import
{
provide
,
ref
}
from
'vue'
import
mitt
from
'mitt'
import
{
themeOverrides
}
from
'@/config/theme-config'
...
...
@@ -7,16 +7,20 @@ import { useResizeObserver } from '@vueuse/core'
import
{
useDesignSettingStore
}
from
'@/store/modules/design-setting'
import
{
useUserStore
}
from
'./store/modules/user'
import
MessageTipModal
from
'@/components/message-tip-modal/message-tip-modal.vue'
import
{
useSystemLanguageStore
}
from
'@/store/modules/system-language'
const
designSettingStore
=
useDesignSettingStore
()
const
userStore
=
useUserStore
()
const
systemLanguageStore
=
useSystemLanguageStore
()
const
emitter
=
mitt
<
MittEvents
>
()
provide
(
'emitter'
,
emitter
)
const
currentLocale
=
ref
(
zhCN
)
const
currentDateLocale
=
ref
(
dateZhCN
)
// const currentLocale = ref(zhCN)
const
currentLocale
=
ref
(
localeParser
())
// const currentDateLocale = ref(dateZhCN)
const
currentDateLocale
=
ref
(
dateLocaleParser
())
const
rootContainer
=
ref
<
HTMLDivElement
|
null
>
(
null
)
...
...
@@ -40,11 +44,35 @@ useResizeObserver(rootContainer, (entries) => {
designSettingStore
.
toggleSidebarDisplayStatus
(
'expand'
)
}
})
/* created */
;(
function
()
{
if
(
userStore
.
isLogin
)
{
userStore
.
fetchUpdateUserInfo
()
}
})()
function
localeParser
()
{
switch
(
systemLanguageStore
.
currentLanguageInfo
.
key
)
{
case
'zh-CN'
:
return
zhCN
case
'zh-HK'
:
return
zhTW
case
'en'
:
return
enUS
}
}
function
dateLocaleParser
()
{
switch
(
systemLanguageStore
.
currentLanguageInfo
.
key
)
{
case
'zh-CN'
:
return
dateZhCN
case
'zh-HK'
:
return
dateZhTW
case
'en'
:
return
dateEnUS
}
}
</
script
>
<
template
>
...
...
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