Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
水玉婷
ai-wechat
Commits
30b3eff6
Commit
30b3eff6
authored
Jan 23, 2026
by
水玉婷
Browse files
feat:为ant-design-vue配置中文语言包
parent
403f09ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/App.vue
View file @
30b3eff6
<
template
>
<div
id=
"app"
>
<router-view
/>
</div>
<a-config-provider
:locale=
"locale"
>
<div
id=
"app"
>
<router-view
/>
</div>
</a-config-provider>
</
template
>
<
script
>
import
zhCN
from
'
ant-design-vue/es/locale/zh_CN
'
;
export
default
{
name
:
'
App
'
name
:
'
App
'
,
data
()
{
return
{
locale
:
zhCN
}
}
}
</
script
>
...
...
src/main.js
View file @
30b3eff6
...
...
@@ -8,10 +8,21 @@ import { initGlobalErrorHandler, handle401Error, is401Error } from './utils/erro
import
Antd
from
'
ant-design-vue
'
;
import
'
ant-design-vue/dist/antd.css
'
;
// 引入中文语言包
import
zhCN
from
'
ant-design-vue/es/locale/zh_CN
'
;
import
dayjs
from
'
dayjs
'
;
import
'
dayjs/locale/zh-cn
'
;
// 配置dayjs为中文
dayjs
.
locale
(
'
zh-cn
'
);
const
app
=
createApp
(
App
)
app
.
use
(
router
)
app
.
use
(
Antd
)
// 配置全局中文语言
app
.
config
.
globalProperties
.
$ANTD_LOCALE
=
zhCN
;
// 设置全局路由实例
setRouter
(
router
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment