Merge pull request #928 from luckcoding/fix-bread-link

fix bread route has no matching lang
This commit is contained in:
Baorong Li
2018-12-13 22:35:56 +08:00
committed by GitHub
5 changed files with 13 additions and 14 deletions
+7 -7
View File
@@ -12,7 +12,7 @@ You can do some custom configuration in `/src/utils/config.js`:
- Type `String`
Configure the copyright notice to apply to the login page, at the bottom of the `Primay` layout.
Configure the copyright notice to apply to the login page, at the bottom of the `Primary` layout.
## logoPath
@@ -44,20 +44,20 @@ You can do some custom configuration in `/src/utils/config.js`:
{
name: 'primary',
include: [/.*/],
exlude: [/(\/(en|zh))*\/login/],
exclude: [/(\/(en|zh))*\/login/],
},
],
```
The object properties for each layout are as follows:
- `name` - The name of the layout;
- `name` - The name of the layout;
- `include` - Specifies a list of routing rules that use this layout, which can be a regular expression or a string;
- `exlude` - Specifies a list of routing rules that do not use this layout, which can be a regular expression or a string.
- `exclude` - Specifies a list of routing rules that do not use this layout, which can be a regular expression or a string.
> Note: `exlude` takes precedence over `include`, and the layout previous it has a higher priority than the behind layout. The development process may need to be combined with the layout in the `src/layouts` directory. For details, see [Using Layout](./layout.md).
> Note: `exclude` takes precedence over `include`, and the layout previous it has a higher priority than the behind layout. The development process may need to be combined with the layout in the `src/layouts` directory. For details, see [Using Layout](./layout.md).
## i18n
@@ -91,9 +91,9 @@ You can do some custom configuration in `/src/utils/config.js`:
- `key` - The `key` of the language is applied to the page url to distinguish the language, and also corresponds to the language package folder name in the `src/locales` directory;
- `title` - The name of the language, at the bottom of the login page, at the top of the `Primay` layout, the language switch is displayed;
- `title` - The name of the language, at the bottom of the login page, at the top of the `Primary` layout, the language switch is displayed;
- `flag` - The path of the flag icon of the language, the language switching display at the top of the `Primay` layout.
- `flag` - The path of the flag icon of the language, the language switching display at the top of the `Primary` layout.
### i18n.defaultLanguage
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "antd-admin",
"version": "5.0.0",
"version": "5.0.1",
"private": true,
"description": "An admin dashboard application demo built upon Ant Design and UmiJS",
"dependencies": {
+2 -2
View File
@@ -4,7 +4,7 @@ import { Breadcrumb, Icon } from 'antd'
import Link from 'umi/navlink'
import withRouter from 'umi/withRouter'
import { withI18n } from '@lingui/react'
import { pathMatchRegexp, queryAncestors } from 'utils'
import { pathMatchRegexp, queryAncestors, addLangPrefix } from 'utils'
import styles from './Bread.less'
@withI18n()
@@ -24,7 +24,7 @@ class Bread extends PureComponent {
return (
<Breadcrumb.Item key={key}>
{paths.length - 1 !== key ? (
<Link to={item.route || '#'}>{content}</Link>
<Link to={addLangPrefix(item.route) || '#'}>{content}</Link>
) : (
content
)}
+1 -1
View File
@@ -8,7 +8,7 @@ export default {
queryUser: '/user/:id',
queryUserList: '/users',
updateUser: 'Patch /user/:id',
createUser: 'POST /user/:id',
createUser: 'POST /user',
removeUser: 'DELETE /user/:id',
removeUserList: 'POST /users/delete',
+2 -3
View File
@@ -246,9 +246,8 @@ export function getLocale() {
export function setLocale(language) {
if (getLocale() !== language) {
umiRouter.push({
pathname: `/${language}${deLangPrefix(window.location.pathname)}${
window.location.search
}`,
pathname: `/${language}${deLangPrefix(window.location.pathname)}`,
search: window.location.search,
})
}
}