Skip to content

Commit

Permalink
add umi-plugin-polyfill
Browse files Browse the repository at this point in the history
add zh_CN
  • Loading branch information
xiaohuoni committed May 25, 2018
1 parent 74ad474 commit 48431ba
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 65 deletions.
5 changes: 3 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"rules": {
"require-yield": 1,
"no-extend-native": 0,
"jsx-a11y/href-no-hash":0
"jsx-a11y/href-no-hash": 0,
"react/no-deprecated": 0
}
}
}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ npm-debug.log*
.vscode

package-lock.json
.vscode/settings.json
.vscode/settings.json

yarn.lock
package-lock.json
25 changes: 14 additions & 11 deletions .umirc.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
export default {
plugins: [
["umi-plugin-dva"],
[
"umi-plugin-polyfill",
{
extend: ["url-polyfill"]
}
],
[
"umi-plugin-routes",
{
update(routes) {
return [
// ...require("./src/pages/_routes"),
...routes
];
return [...require("./src/pages/_routes"), ...routes];
}
}
],
// [
// "umi-plugin-dll",
// {
// exclude: [],
// include: ["dva", "dva/router", "dva/saga", "dva/fetch", "antd/es"]
// }
// ]
[
"umi-plugin-dll",
{
exclude: [],
include: ["dva", "dva/router", "dva/saga", "dva/fetch", "antd/es"]
}
]
],
pages: {
"/": {
Expand Down
22 changes: 1 addition & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,7 @@
# Umi Antd Pro
所有的组件和页面逻辑保留 Ant Design Pro的设计。

## 增加
- dva.js onError 和 initialState
- 增加配置服务器地址,支持build之后可预览
- 增加[antd-pro-server](https://github.com/xiaohuoni/antd-pro-server),主要修改.umirc.mock.js
20180517
- 去除手动重定向路由,加入umi配置路由pages/_route.json
20180518 更新umi@1.3.3
- 去掉NO_PROXY,umi@1.3.3 已内置关闭MOCK=none
- 更新React 16.3.0,修改componentWillReceiveProps为UNSAFE_componentWillReceiveProps
- 增加插件umi-plugin-dll,二次编译速度提升70%

如果出现[umi/#495](https://github.com/umijs/umi/issues/495)问题,可以先注释掉.umirc.js里
```js
[
"umi-plugin-dll",
{
exclude: [],
include: ["dva", "dva/router", "dva/saga", "dva/fetch", "antd/es"]
}
]
```
# 更新日志请查看 [releases](https://github.com/xiaohuoni/umi-antd-pro/releases)

# Ant Design Pro

Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"description": "umi example with ant design pro",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "cross-env DEBUG=umi*,af-webpack* HARD_SOURCE=none COMPILE_ON_DEMAND=none umi dev",
"start": "cross-env HARD_SOURCE=none COMPILE_ON_DEMAND=none umi dev",
"start:noharesource": "cross-env HARD_SOURCE=none COMPILE_ON_DEMAND=none umi dev",
"start:debug": "cross-env DEBUG=umi*,af-webpack* HARD_SOURCE=none COMPILE_ON_DEMAND=none umi dev",
"start:no-proxy": "cross-env MOCK=none umi dev",
"build": "umi build",
"lint": "eslint --ext .js src test",
Expand All @@ -29,10 +31,11 @@
"cross-env": "^5.1.4",
"mockjs": "^1.0.1-beta3",
"moment": "^2.22.1",
"umi": "1.3.3",
"umi": "1.3.4",
"umi-plugin-dll": "^0.2.1",
"umi-plugin-dva": "^0.7.2",
"umi-plugin-routes": "0.1.4"
"umi-plugin-dva": "^0.7.3",
"umi-plugin-routes": "0.1.4",
"umi-plugin-polyfill": "^0.1.0"
},
"dependencies": {
"@antv/data-set": "^0.8.7",
Expand Down
11 changes: 0 additions & 11 deletions src/global.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
import '@babel/polyfill';
import 'url-polyfill';
Object.setPrototypeOf = require('setprototypeof')
if (window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = function(callback, thisArg) {
thisArg = thisArg || window;
for (var i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this);
}
};
}
// import Rollbar from 'rollbar';

// // Track error by rollbar.com
Expand Down
31 changes: 17 additions & 14 deletions src/layouts/index.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import BasicLayout from './BasicLayout';
import BasicLayout from "./BasicLayout";
import { config } from "utils";
import { getRouterData } from 'common/router';
const { openPages } = config;
export default (props) => {
const { children ,location} = props;
import { getRouterData } from "common/router";
import { LocaleProvider } from "antd";
import zh_CN from "antd/lib/locale-provider/zh_CN";
import "moment/locale/zh-cn";

const { openPages } = config;
export default props => {
const { children, location } = props;
const routerData = getRouterData({});
const newProps = {
...props,
routerData:routerData
}
routerData: routerData
};
let { pathname } = location;
pathname = pathname.startsWith("/") ? pathname : `/${pathname}`;
if (openPages && openPages.includes(pathname)) {
return (
<div style={{height:'100%'}}>
{children}
</div>
);
return <div style={{ height: "100%" }}>{children}</div>;
}
return (<BasicLayout {...newProps}/>
return (
<LocaleProvider locale={zh_CN}>
<BasicLayout {...newProps} />
</LocaleProvider>
);
}
};
2 changes: 1 addition & 1 deletion src/pages/Forms/StepForm/_layout.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { PureComponent, Fragment } from 'react';
import { Card, Steps } from 'antd';
import PageHeaderLayout from '../../../layouts/PageHeaderLayout';
import NotFound from '../../Exception/404';
// import NotFound from '../../Exception/404';
import styles from '../style.less';

const { Step } = Steps;
Expand Down

0 comments on commit 48431ba

Please sign in to comment.