diff --git a/package.json b/package.json
index 593d3b3..62184ae 100644
--- a/package.json
+++ b/package.json
@@ -7,6 +7,7 @@
"dva": "^1.1.0",
"dva-loading": "^0.2.0",
"lodash": "^4.17.4",
+ "nprogress": "^0.2.0",
"qs": "^6.2.0",
"react": "^15.4.1",
"react-countup": "1.3.0",
@@ -34,6 +35,7 @@
"jsonp": "^0.2.1",
"less-vars-to-js": "^1.1.2",
"mockjs": "^1.0.1-beta3",
+ "path-to-regexp": "^1.7.0",
"rc-tween-one": "^1.0.0",
"redbox-react": "^1.2.10"
},
@@ -41,16 +43,8 @@
"lint"
],
"scripts": {
- "dev": "set BROWSER=none&&roadhog server",
+ "dev": "set BROWSER=none&&set HOST=0.0.0.0&&roadhog server",
"lint": "eslint --fix --ext .js src",
- "build": "roadhog build"
- },
- "theme": "./src/theme.js",
- "standard": {
- "parser": "babel-eslint",
- "globals": [
- "location",
- "localStorage"
- ]
+ "build": "roadhog build --analyze"
}
}
diff --git a/src/components/DataTable/AnimTableBody.js b/src/components/DataTable/AnimTableBody.js
index 4160e42..c4b6e58 100644
--- a/src/components/DataTable/AnimTableBody.js
+++ b/src/components/DataTable/AnimTableBody.js
@@ -1,4 +1,5 @@
-import React, { PropTypes } from 'react'
+import React from 'react'
+import PropTypes from 'prop-types'
import { TweenOneGroup } from 'rc-tween-one'
const enterAnim = [
diff --git a/src/components/DataTable/DataTable.js b/src/components/DataTable/DataTable.js
index 076e181..23eaf4a 100644
--- a/src/components/DataTable/DataTable.js
+++ b/src/components/DataTable/DataTable.js
@@ -1,4 +1,5 @@
-import React, { PropTypes } from 'react'
+import React from 'react'
+import PropTypes from 'prop-types'
import { Table } from 'antd'
import { request } from '../../utils'
import lodash from 'lodash'
diff --git a/src/components/DropOption/DropOption.js b/src/components/DropOption/DropOption.js
index 995c26b..3fe6d85 100644
--- a/src/components/DropOption/DropOption.js
+++ b/src/components/DropOption/DropOption.js
@@ -1,4 +1,5 @@
-import React, { PropTypes } from 'react'
+import React from 'react'
+import PropTypes from 'prop-types'
import { Dropdown, Button, Icon, Menu } from 'antd'
const DropOption = ({ onMenuClick, menuOptions = [], buttonStyle, dropdownProps }) => {
diff --git a/src/components/Iconfont/Iconfont.js b/src/components/Iconfont/Iconfont.js
index 66a159b..ddfa17f 100644
--- a/src/components/Iconfont/Iconfont.js
+++ b/src/components/Iconfont/Iconfont.js
@@ -1,4 +1,5 @@
-import React, { PropTypes } from 'react'
+import React from 'react'
+import PropTypes from 'prop-types'
import './iconfont.less'
const Iconfont = ({ type }) => {
- pathSet[(parentPath + item.key).replace(/\//g, '-').hyphenToHump()] = {
- path: parentPath + item.key,
- name: item.name,
- icon: item.icon || '',
- clickable: item.clickable === undefined,
+const Bread = ({ location, menu }) => {
+ // 匹配当前路由
+ let pathArray = []
+ let current
+ for (let index in menu) {
+ if (menu[index].router && pathToRegexp(menu[index].router).exec(location.pathname)) {
+ current = menu[index]
+ break
}
- if (item.child) {
- getPathSet(item.child, `${parentPath}${item.key}/`)
- }
- })
-}
-getPathSet(menu)
+ }
-function Bread ({ location }) {
- let pathNames = []
- location.pathname.substr(1).split('/').forEach((item, key) => {
- if (key > 0) {
- pathNames.push((`${pathNames[key - 1]}-${item}`).hyphenToHump())
- } else {
- pathNames.push((`-${item}`).hyphenToHump())
- }
- })
+ if (!current) {
+ return (