Skip to content

Commit 5ed16da

Browse files
author
cole
committed
feat: 多语言
1 parent 6aeebba commit 5ed16da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+304
-219
lines changed

src/App.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import dayjs from 'dayjs'
77
import { createAppInstance } from './useAppInstance'
88

99
export default defineComponent({
10+
inheritAttrs: false,
1011
setup () {
1112
const { locale, getLocaleMessage } = useI18n()
1213

src/components/icon/ExitFullscreenOutlined.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent } from 'vue'
22
import Icon from '@ant-design/icons-vue'
33

44
export default defineComponent({
5+
inheritAttrs: false,
56
setup (props, { attrs }) {
67
return () => {
78
const iconSlots = {

src/components/icon/FullscreenOutlined.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent } from 'vue'
22
import Icon from '@ant-design/icons-vue'
33

44
export default defineComponent({
5+
inheritAttrs: false,
56
setup (props, { attrs }) {
67
return () => {
78
const iconSlots = {

src/components/icon/HamburgerOutlined.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent } from 'vue'
22
import Icon from '@ant-design/icons-vue'
33

44
export default defineComponent({
5+
inheritAttrs: false,
56
setup (props, { attrs }) {
67
return () => {
78
const iconSlots = {

src/components/icon/MenuOutlined.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent } from 'vue'
22
import Icon from '@ant-design/icons-vue'
33

44
export default defineComponent({
5+
inheritAttrs: false,
56
setup (props, { attrs }) {
67
return () => {
78
const iconSlots = {

src/components/icon/PasswordFilled.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent } from 'vue'
22
import Icon from '@ant-design/icons-vue'
33

44
export default defineComponent({
5+
inheritAttrs: false,
56
setup (props, { attrs }) {
67
return () => {
78
const iconSlots = {

src/components/icon/UserFilled.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { defineComponent } from 'vue'
22
import Icon from '@ant-design/icons-vue'
33

44
export default defineComponent({
5+
inheritAttrs: false,
56
setup (props, { attrs }) {
67
return () => {
78
const iconSlots = {

src/components/loading/Loading.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import styles from './style/index.module.scss'
55
const cx = classNames.bind(styles)
66

77
export default defineComponent({
8+
inheritAttrs: false,
89
props: {
910
onClose: {
1011
type: Function,

src/layout/compatible/sidebar/OutIcon.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default defineComponent({
66
inheritAttrs: false,
77
props: {
88
type: {
9-
type: [String, Function],
9+
type: [String, Function, Boolean],
1010
default: undefined
1111
}
1212
},
@@ -18,7 +18,10 @@ export default defineComponent({
1818
if (props.type && isString(props.type)) {
1919
return <Icon type={props.type}/>
2020
}
21-
return <MenuOutlined/>
21+
if (props.type !== false) {
22+
return <MenuOutlined/>
23+
}
24+
return null
2225
}
2326
}
2427
})

src/layout/compatible/tags/Node.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useConfigInject } from '@utils/extend'
55
import useStyle from './style/node'
66

77
export default defineComponent({
8+
inheritAttrs: false,
89
props: {
910
closable: {
1011
type: Boolean,

src/layout/compatible/tags/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import useStyle from './style'
1010
import { isString } from 'lodash-es'
1111

1212
export default defineComponent({
13+
inheritAttrs: false,
1314
props: {
1415
homeName: {
1516
type: String,

src/locale/en-US/error-pages.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
403: 'You are not authorized to access this page',
3+
404: 'The page you visited does not exist',
4+
500: 'The server is wrong',
5+
backHome: 'Back Home'
6+
}

src/locale/en-US/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import dayjs from 'dayjs/locale/en'
44
// --
55
import routes from './routes'
66
import layout from './layout'
7+
import errorPages from './error-pages'
78

89
export default {
910
locale: 'en-US',
1011
antd: antd,
1112
packages: packages,
1213
dayjs: dayjs,
1314
routes: routes,
14-
layout: layout
15+
layout: layout,
16+
errorPages: errorPages
1517
}

src/locale/en-US/routes.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
export default {
22
HomeIndex: 'Home',
33
Form: 'Form',
4-
FormLayout: 'Form Layout',
5-
FormModal: 'Modal Form',
6-
FormDrawer: 'Drawer Form',
7-
FormFilter: 'Filter Form',
8-
Table: 'Table',
9-
TableIndex: 'Table',
10-
TableCustomSearch: 'Custom Search',
11-
TableEditableTable: 'Editable Table',
12-
Descriptions: 'Descriptions',
13-
DescriptionsIndex: 'Descriptions',
14-
Test: 'Test',
15-
TestIndex: 'Test'
4+
FormBasicForm: 'Basic Form',
5+
FormFloatingForm: 'Floating Form',
6+
List: 'List',
7+
ListTable: 'Query Table',
8+
ListEditableTable: 'Editable Table',
9+
Exception: 'Exception',
10+
Examples: 'Examples',
11+
ExamplesDescriptions: 'Descriptions',
12+
ExamplesTest: 'Test'
1613
}

src/locale/zh-CN/error-pages.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
403: '您无权访问此页面',
3+
404: '您访问的页面不存在',
4+
500: '服务器错误',
5+
backHome: '返回首页'
6+
}

src/locale/zh-CN/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import dayjs from 'dayjs/locale/zh-cn'
44
// --
55
import routes from './routes'
66
import layout from './layout'
7+
import errorPages from './error-pages'
78

89
export default {
910
locale: 'zh-CN',
1011
antd: antd,
1112
packages: packages,
1213
dayjs: dayjs,
1314
routes: routes,
14-
layout: layout
15+
layout: layout,
16+
errorPages: errorPages
1517
}

src/locale/zh-CN/routes.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
export default {
22
HomeIndex: '首页',
3-
Form: '表单',
4-
FormLayout: '表单布局',
5-
FormModal: '浮层表单',
6-
FormDrawer: '抽屉表单',
7-
FormFilter: '筛选表单',
8-
Table: '表格',
9-
TableIndex: '表格',
10-
TableCustomSearch: '自定义搜索',
11-
TableEditableTable: '可编辑表格',
12-
Descriptions: '描述列表',
13-
DescriptionsIndex: '描述列表',
14-
Test: '测试',
15-
TestIndex: '测试'
3+
Form: '表单页',
4+
FormBasicForm: '基础表单',
5+
FormFloatingForm: '浮层表单',
6+
List: '列表页',
7+
ListTable: '查询表格',
8+
ListEditableTable: '可编辑表格',
9+
Exception: '异常页',
10+
Examples: '组件展示',
11+
ExamplesDescriptions: '描述列表',
12+
ExamplesTest: '测试'
1613
}

src/router/routes/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
## META
22

3-
| 属性 | 说明 | 类型 | 默认值 |
4-
|------------|-----------------------------|--------------------|-----|
5-
| title | 导航栏 title | string | - |
6-
| icon | 导航栏 icon | string \| function | - |
7-
| hideInMenu | 设为 true 后在左侧菜单不会显示该页面选项 | boolean | - |
8-
| hltInName | 高亮的路由 name | string | - |
9-
| access | 可访问该页面的权限数组 当前路由设置的权限会影响子路由 | string \| number | - |
10-
| notCache | 设为 true 后 KeepAlive 混缓存页面 | boolean | - |
3+
| 属性 | 说明 | 类型 | 默认值 |
4+
|------------|-----------------------------|-----------------------------|-----|
5+
| title | 导航栏 title | string | - |
6+
| icon | 导航栏 icon | string \| function \| false | - |
7+
| hideInMenu | 设为 true 后在左侧菜单不会显示该页面选项 | boolean | - |
8+
| hltInName | 高亮的路由 name | string | - |
9+
| access | 可访问该页面的权限数组 当前路由设置的权限会影响子路由 | string \| number | - |
10+
| notCache | 设为 true 后 KeepAlive 混缓存页面 | boolean | - |
1111

src/router/routes/error-pages.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import Error403 from '@/views/error-pages/403'
2+
import Error404 from '@/views/error-pages/404'
3+
import Error500 from '@/views/error-pages/500'
4+
5+
const errorPages = [
6+
{
7+
path: '/403',
8+
name: 'Error403',
9+
meta: {
10+
hideInMenu: true,
11+
notCache: true
12+
},
13+
component: Error403
14+
},
15+
{
16+
path: '/404',
17+
name: 'Error404',
18+
meta: {
19+
hideInMenu: true,
20+
notCache: true
21+
},
22+
component: Error404
23+
},
24+
{
25+
path: '/500',
26+
name: 'Error500',
27+
meta: {
28+
hideInMenu: true,
29+
notCache: true
30+
},
31+
component: Error500
32+
},
33+
{
34+
path: '/:pathMatch(.*)*',
35+
meta: {
36+
hideInMenu: true,
37+
notCache: true
38+
},
39+
component: Error404
40+
}
41+
]
42+
43+
export default errorPages

src/router/routes/errorPages.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)