mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-18 13:04:46 +08:00
feat: add redux-devtools
This commit is contained in:
parent
fff8a8befd
commit
2efcd4841e
11
client/containers/DevTools/DevTools.js
Normal file
11
client/containers/DevTools/DevTools.js
Normal file
@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
import { createDevTools } from 'redux-devtools';
|
||||
import LogMonitor from 'redux-devtools-log-monitor';
|
||||
import DockMonitor from 'redux-devtools-dock-monitor';
|
||||
const DockMonitorD = DockMonitor.default // 这里有 bug 不知道为啥非要使用 default
|
||||
|
||||
export default createDevTools(
|
||||
<DockMonitorD toggleVisibilityKey="ctrl-h" changePositionKey="ctrl-q">
|
||||
<LogMonitor.default />
|
||||
</DockMonitorD>
|
||||
);
|
@ -5,6 +5,7 @@ import ProjectGroups from './ProjectGroups/ProjectGroups.js'
|
||||
import Interface from './Interface/Interface.js'
|
||||
import News from './News/News.js'
|
||||
import AddInterface from './AddInterface/AddInterface.js'
|
||||
import DevTools from './DevTools/DevTools.js'
|
||||
|
||||
export {
|
||||
Header,
|
||||
@ -13,5 +14,6 @@ export {
|
||||
ProjectGroups,
|
||||
Interface,
|
||||
AddInterface,
|
||||
News
|
||||
News,
|
||||
DevTools
|
||||
}
|
||||
|
@ -4,19 +4,30 @@ import thunkMiddleware from 'redux-thunk'
|
||||
import promiseMiddleware from 'redux-promise';
|
||||
import ReactDOM from 'react-dom'
|
||||
import App from './Application'
|
||||
import { createStore, combineReducers, applyMiddleware } from 'redux'
|
||||
import { createStore, combineReducers, applyMiddleware, compose } from 'redux'
|
||||
import { Provider } from 'react-redux'
|
||||
import ReduxContainer from './ReduxContainer.js'
|
||||
import { DevTools } from './containers';
|
||||
|
||||
const enhancer = compose(
|
||||
// Middleware you want to use in development:
|
||||
applyMiddleware(
|
||||
thunkMiddleware.default,
|
||||
promiseMiddleware
|
||||
),
|
||||
// Required! Enable Redux DevTools with the monitors you chose
|
||||
DevTools.instrument()
|
||||
);
|
||||
|
||||
// 合并 redux 创建stroe
|
||||
const store = createStore(combineReducers( ReduxContainer ), applyMiddleware(
|
||||
thunkMiddleware.default,
|
||||
promiseMiddleware
|
||||
))
|
||||
const store = createStore(combineReducers( ReduxContainer ), {}, enhancer)
|
||||
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
<App />
|
||||
<div>
|
||||
<App />
|
||||
<DevTools />
|
||||
</div>
|
||||
</Provider>,
|
||||
document.getElementById('yapi')
|
||||
)
|
||||
|
13
package.json
13
package.json
@ -63,13 +63,11 @@
|
||||
"wangeditor": "^3.0.4",
|
||||
"ykit-config-antd": "^0.1.3",
|
||||
"ykit-config-react": "^0.4.4",
|
||||
"axios": "^0.16.2",
|
||||
"babel": "^6.5.2",
|
||||
"babel-cli": "^6.24.1",
|
||||
"babel-core": "^6.8.0",
|
||||
"babel-eslint": "^7.2.3",
|
||||
"babel-loader": "^6.2.4",
|
||||
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
||||
"babel-plugin-transform-object-rest-spread": "^6.8.0",
|
||||
"babel-plugin-transform-runtime": "^6.9.0",
|
||||
"babel-preset-es2015": "^6.9.0",
|
||||
@ -85,15 +83,11 @@
|
||||
"eslint-plugin-react": "^7.1.0",
|
||||
"express": "^4.15.3",
|
||||
"extract-text-webpack-plugin": "^1.0.1",
|
||||
"fast-sass-loader": "^1.2.5",
|
||||
"fs-extra": "^3.0.1",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-babel": "^6.1.2",
|
||||
"gulp-watch": "^4.3.11",
|
||||
"node-sass": "^4.5.3",
|
||||
|
||||
"ora": "^1.3.0",
|
||||
"prop-types": "^15.5.10",
|
||||
"react": "^15.6.1",
|
||||
"react-dom": "^15.6.1",
|
||||
"react-redux": "^5.0.5",
|
||||
@ -106,10 +100,13 @@
|
||||
"validate-commit-msg": "^2.12.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ghooks": "^2.0.0",
|
||||
"nodemon": "^1.11.0",
|
||||
"redux-devtools": "^3.4.0",
|
||||
"redux-devtools-dock-monitor": "^1.1.2",
|
||||
"redux-devtools-log-monitor": "^1.3.0",
|
||||
"webpack": "^2.0.0",
|
||||
"webpack-node-externals": "^1.6.0",
|
||||
"ghooks": "^2.0.0"
|
||||
"webpack-node-externals": "^1.6.0"
|
||||
},
|
||||
"config": {
|
||||
"ghooks": {
|
||||
|
Loading…
Reference in New Issue
Block a user