Skip to content

Commit b5e4ddc

Browse files
committed
update package.json
1 parent cd7ebde commit b5e4ddc

File tree

4 files changed

+131
-65
lines changed

4 files changed

+131
-65
lines changed

package.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
},
2525
"dependencies": {
2626
"@rematch/core": "^1.3.0",
27-
"antd": "3.26.4",
28-
"antd-dayjs-webpack-plugin": "^0.0.7",
29-
"axios": "^0.19.0",
30-
"core-js": "^3.6.1",
27+
"antd": "3.26.7",
28+
"antd-dayjs-webpack-plugin": "^0.0.8",
29+
"axios": "^0.19.1",
30+
"core-js": "^3.6.4",
3131
"history": "^4.10.1",
3232
"lodash": "^4.17.15",
3333
"react": "^16.12.0",
@@ -38,28 +38,28 @@
3838
"redux": "^4.0.5"
3939
},
4040
"devDependencies": {
41-
"@babel/core": "^7.7.7",
42-
"@babel/plugin-proposal-class-properties": "^7.7.4",
43-
"@babel/plugin-proposal-decorators": "^7.7.4",
44-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.7.4",
45-
"@babel/plugin-proposal-object-rest-spread": "^7.7.7",
46-
"@babel/plugin-proposal-optional-chaining": "^7.7.5",
47-
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
48-
"@babel/plugin-transform-runtime": "^7.7.6",
49-
"@babel/preset-env": "^7.7.7",
50-
"@babel/preset-react": "^7.7.4",
51-
"@babel/runtime": "^7.7.7",
52-
"autoprefixer": "^9.7.3",
41+
"@babel/core": "^7.8.3",
42+
"@babel/plugin-proposal-class-properties": "^7.8.3",
43+
"@babel/plugin-proposal-decorators": "^7.8.3",
44+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3",
45+
"@babel/plugin-proposal-object-rest-spread": "^7.8.3",
46+
"@babel/plugin-proposal-optional-chaining": "^7.8.3",
47+
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
48+
"@babel/plugin-transform-runtime": "^7.8.3",
49+
"@babel/preset-env": "^7.8.3",
50+
"@babel/preset-react": "^7.8.3",
51+
"@babel/runtime": "^7.8.3",
52+
"autoprefixer": "^9.7.4",
5353
"babel-eslint": "^10.0.3",
5454
"babel-loader": "^8.0.6",
5555
"babel-plugin-import": "^1.13.0",
5656
"body-parser": "^1.19.0",
5757
"clean-webpack-plugin": "^3.0.0",
58-
"css-loader": "^3.4.0",
58+
"css-loader": "^3.4.2",
5959
"eslint": "^6.8.0",
6060
"eslint-loader": "^3.0.3",
6161
"eslint-plugin-prettier": "^3.1.2",
62-
"eslint-plugin-react": "^7.17.0",
62+
"eslint-plugin-react": "^7.18.0",
6363
"eslint-plugin-react-hooks": "^2.3.0",
6464
"express": "^4.17.1",
6565
"favicons-webpack-plugin": "2.0.0",
@@ -73,11 +73,11 @@
7373
"optimize-css-assets-webpack-plugin": "^5.0.3",
7474
"postcss-loader": "^3.0.0",
7575
"prettier": "1.19.1",
76-
"style-loader": "1.0.1",
76+
"style-loader": "1.1.3",
7777
"sw-precache-webpack-plugin": "^0.11.5",
78-
"terser-webpack-plugin": "^2.3.1",
78+
"terser-webpack-plugin": "^2.3.2",
7979
"url-loader": "^3.0.0",
80-
"webpack": "^4.41.4",
80+
"webpack": "^4.41.5",
8181
"webpack-cli": "^3.3.10",
8282
"webpack-dev-middleware": "^3.7.2",
8383
"webpack-hot-middleware": "^2.25.0",

src/container/routers/index.js

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@ import "./index.less";
2424
const Home = Loadable({
2525
loader: () => import(/* webpackChunkName:'home' */ "../home"),
2626
loading: Loading, // 自定义的Loading动画组件
27-
timeout: 10000, // 可以设置一个超时时间(s)来应对网络慢的情况(在Loading动画组件中可以配置error信息)
27+
timeout: 10000 // 可以设置一个超时时间(s)来应对网络慢的情况(在Loading动画组件中可以配置error信息)
2828
});
2929
const Test = Loadable({
3030
loader: () => import(/* webpackChunkName:'test' */ "../test"),
31-
loading: Loading,
31+
loading: Loading
3232
});
3333
const TestClass = Loadable({
3434
loader: () => import(/* webpackChunkName:'testclass' */ "../testclass"),
35-
loading: Loading,
35+
loading: Loading
3636
});
3737
const Features = Loadable({
3838
loader: () => import(/* webpackChunkName:'features' */ "../features"),
39-
loading: Loading,
39+
loading: Loading
4040
});
4141
const NotFound = Loadable({
4242
loader: () => import(/* webpackChunkName:'notfound' */ "../notfound"),
43-
loading: Loading,
43+
loading: Loading
4444
});
4545

4646
const history = createHistory(); // 实例化history对象
@@ -77,10 +77,22 @@ function RootRouterContainer(props) {
7777
<div className="boss">
7878
<Switch>
7979
<Redirect exact from="/" to="/home" />
80-
<Route path="/home" render={props => onEnter(Home, props)} />
81-
<Route path="/features" render={props => onEnter(Features, props)} />
82-
<Route path="/test" render={props => onEnter(Test, props)} />
83-
<Route path="/testclass" render={props => onEnter(TestClass, props)} />
80+
<Route
81+
path="/home"
82+
render={props => onEnter(Home, props)}
83+
/>
84+
<Route
85+
path="/features"
86+
render={props => onEnter(Features, props)}
87+
/>
88+
<Route
89+
path="/test"
90+
render={props => onEnter(Test, props)}
91+
/>
92+
<Route
93+
path="/testclass"
94+
render={props => onEnter(TestClass, props)}
95+
/>
8496
<Route component={NotFound} />
8597
</Switch>
8698
<Menu />
@@ -98,6 +110,6 @@ function RootRouterContainer(props) {
98110
export default connect(
99111
state => ({}),
100112
dispatch => ({
101-
actions: {},
102-
}),
113+
actions: {}
114+
})
103115
)(RootRouterContainer);

src/container/test/index.js

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function TestPageContainer({
2222
match, // 自动注入的match对象
2323
history, // 自动注入的history对象
2424
actions, // 上面model中定义的actions对象,自动成为this.props.actions变量
25-
form, // antd的form表单高阶组件自动注入的form对象
25+
form // antd的form表单高阶组件自动注入的form对象
2626
}) {
2727
const [visible, setVisible] = useState(false); // 模态框隐藏和显示
2828
const [mokeFetch, setMokeFetch] = useState([]); // 用于测试fetch请求
@@ -93,11 +93,17 @@ function TestPageContainer({
9393
<span className="backImage" />
9494
<span>上方图片,一张是img,一张是background</span>
9595
<br />
96-
<span>请特别注意,现在webpack.production.config.js中的publicPath配置为"/",</span>
96+
<span>
97+
请特别注意,现在webpack.production.config.js中的publicPath配置为"/",
98+
</span>
9799
<br />
98-
<span>如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题</span>
100+
<span>
101+
如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题
102+
</span>
99103
<br />
100-
<span>如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/"</span>
104+
<span>
105+
如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/"
106+
</span>
101107
</p>
102108
</div>
103109
<div className="list">
@@ -133,13 +139,21 @@ function TestPageContainer({
133139
<Form onSubmit={handleSubmit}>
134140
<Form.Item>
135141
{getFieldDecorator("username", {
136-
rules: [{ required: true, message: "请输入用户名" }],
137-
})(<Input prefix={<Icon type="user" />} placeholder="用户名" />)}
142+
rules: [{ required: true, message: "请输入用户名" }]
143+
})(
144+
<Input prefix={<Icon type="user" />} placeholder="用户名" />
145+
)}
138146
</Form.Item>
139147
<Form.Item>
140148
{getFieldDecorator("password", {
141-
rules: [{ required: true, message: "请输入密码" }],
142-
})(<Input type="password" prefix={<Icon type="lock" />} placeholder="密码" />)}
149+
rules: [{ required: true, message: "请输入密码" }]
150+
})(
151+
<Input
152+
type="password"
153+
prefix={<Icon type="lock" />}
154+
placeholder="密码"
155+
/>
156+
)}
143157
</Form.Item>
144158
<Form.Item>
145159
<Button type="primary" htmlType="submit">
@@ -208,7 +222,12 @@ function TestPageContainer({
208222
</div>
209223
</div>
210224
</div>
211-
<Modal title="模态框" visible={visible} onOk={() => setVisible(false)} onCancel={() => setVisible(false)}>
225+
<Modal
226+
title="模态框"
227+
visible={visible}
228+
onOk={() => setVisible(false)}
229+
onCancel={() => setVisible(false)}
230+
>
212231
<p>内容...</p>
213232
</Modal>
214233
</div>
@@ -220,13 +239,13 @@ const FormComponent = Form.create()(TestPageContainer);
220239
export default connect(
221240
state => ({
222241
userinfo: state.app.userinfo, // 引入app model中的userinfo数据
223-
count: state.test.count, // 引入test model中的count数据
242+
count: state.test.count // 引入test model中的count数据
224243
}),
225244
dispatch => ({
226245
actions: {
227246
getUserinfo: dispatch.app.getUserinfo, // 引入app model中的获取用户信息action
228247
onTestAdd: dispatch.test.onTestAdd, // 引入test model中的数字+1 action
229-
serverFetch: dispatch.test.serverFetch, // 引入test model中的fetch异步请求action
230-
},
231-
}),
248+
serverFetch: dispatch.test.serverFetch // 引入test model中的fetch异步请求action
249+
}
250+
})
232251
)(FormComponent);

src/container/testclass/index.js

Lines changed: 55 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class TestClassPageContainer extends React.Component {
2424
match: P.any, // 自动注入的match对象
2525
history: P.any, // 自动注入的history对象
2626
actions: P.object, // 上面model中定义的actions对象,自动成为this.props.actions变量
27-
form: P.any, // antd的form表单高阶组件自动注入的form对象
27+
form: P.any // antd的form表单高阶组件自动注入的form对象
2828
};
2929

3030
/** react生命周期 - 构造函数 **/
@@ -34,13 +34,18 @@ class TestClassPageContainer extends React.Component {
3434
visible: false, // 模态框隐藏和显示
3535
mokeFetch: [], // 用于测试fetch请求
3636
mokeAjax: [], // 用于测试ajax请求
37-
count: 0, // 数字
37+
count: 0 // 数字
3838
};
3939
}
4040

4141
/** react生命周期 - 组件初始化完毕DOM挂载完毕后 触发1次 **/
4242
componentDidMount() {
43-
console.log("所有页面默认拥有的3个对象:", this.props.location, this.props.match, this.props.history);
43+
console.log(
44+
"所有页面默认拥有的3个对象:",
45+
this.props.location,
46+
this.props.match,
47+
this.props.history
48+
);
4449
const set = new Set([1, 2, 3]);
4550
const map = new Map();
4651
console.log("Set 和 Map 测试:", set, map);
@@ -83,7 +88,7 @@ class TestClassPageContainer extends React.Component {
8388
static getDerivedStateFromProps(nextProps, nowState) {
8489
if (nextProps.count !== nowState.count) {
8590
return {
86-
count: nextProps.count,
91+
count: nextProps.count
8792
};
8893
}
8994
return null;
@@ -126,14 +131,14 @@ class TestClassPageContainer extends React.Component {
126131
// 打开模态框按钮被点击时触发
127132
onBtnClick() {
128133
this.setState({
129-
visible: true,
134+
visible: true
130135
});
131136
}
132137

133138
// 关闭模态框
134139
handleCancel() {
135140
this.setState({
136-
visible: false,
141+
visible: false
137142
});
138143
}
139144

@@ -142,7 +147,7 @@ class TestClassPageContainer extends React.Component {
142147
this.props.actions.serverFetch().then(res => {
143148
if (res.status === 200) {
144149
this.setState({
145-
mokeFetch: res.data,
150+
mokeFetch: res.data
146151
});
147152
} else {
148153
message.error("获取数据失败");
@@ -164,11 +169,17 @@ class TestClassPageContainer extends React.Component {
164169
<span className="backImage" />
165170
<span>上方图片,一张是img,一张是background</span>
166171
<br />
167-
<span>请特别注意,现在webpack.production.config.js中的publicPath配置为"/",</span>
172+
<span>
173+
请特别注意,现在webpack.production.config.js中的publicPath配置为"/",
174+
</span>
168175
<br />
169-
<span>如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题</span>
176+
<span>
177+
如果你的项目最终打包后放到服务器上的访问路径为https://xxx.com,这没有问题
178+
</span>
170179
<br />
171-
<span>如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/"</span>
180+
<span>
181+
如果你的项目访问路径为https://xxx.com/aaa,请把webpack.production.config.js中的publicPath配置为"/aaa/"
182+
</span>
172183
</p>
173184
</div>
174185
<div className="list">
@@ -219,7 +230,10 @@ class TestClassPageContainer extends React.Component {
219230
<div className="list">
220231
<h2>action测试</h2>
221232
<p>
222-
<Button type="primary" onClick={() => this.props.actions.onTestAdd(this.props.count)}>
233+
<Button
234+
type="primary"
235+
onClick={() => this.props.actions.onTestAdd(this.props.count)}
236+
>
223237
通过action改变数据num
224238
</Button>
225239
<br />
@@ -249,15 +263,36 @@ class TestClassPageContainer extends React.Component {
249263
<Link to={`${this.props.match.url}/Page2`}>子页2</Link>
250264
<Link to={`${this.props.match.url}/Page3`}>子页3</Link>
251265
<Switch>
252-
<Route exact path={`${this.props.match.url}/`} component={Page1} />
253-
<Route exact path={`${this.props.match.url}/Page1`} component={Page1} />
254-
<Route exact path={`${this.props.match.url}/Page2`} component={Page2} />
255-
<Route exact path={`${this.props.match.url}/Page3`} component={Page3} />
266+
<Route
267+
exact
268+
path={`${this.props.match.url}/`}
269+
component={Page1}
270+
/>
271+
<Route
272+
exact
273+
path={`${this.props.match.url}/Page1`}
274+
component={Page1}
275+
/>
276+
<Route
277+
exact
278+
path={`${this.props.match.url}/Page2`}
279+
component={Page2}
280+
/>
281+
<Route
282+
exact
283+
path={`${this.props.match.url}/Page3`}
284+
component={Page3}
285+
/>
256286
</Switch>
257287
</div>
258288
</div>
259289
</div>
260-
<Modal title="模态框" visible={this.state.visible} onOk={() => this.handleCancel()} onCancel={() => this.handleCancel()}>
290+
<Modal
291+
title="模态框"
292+
visible={this.state.visible}
293+
onOk={() => this.handleCancel()}
294+
onCancel={() => this.handleCancel()}
295+
>
261296
<p>内容...</p>
262297
</Modal>
263298
</div>
@@ -269,13 +304,13 @@ const FormComponent = Form.create()(TestClassPageContainer);
269304
export default connect(
270305
state => ({
271306
userinfo: state.app.userinfo, // 引入app model中的userinfo数据
272-
count: state.test.count, // 引入test model中的count数据
307+
count: state.test.count // 引入test model中的count数据
273308
}),
274309
model => ({
275310
actions: {
276311
getUserinfo: model.app.getUserinfo, // 引入app model中的获取用户信息action
277312
onTestAdd: model.test.onTestAdd, // 引入test model中的数字+1 action
278-
serverFetch: model.test.serverFetch, // 引入test model中的fetch异步请求action
279-
},
280-
}),
313+
serverFetch: model.test.serverFetch // 引入test model中的fetch异步请求action
314+
}
315+
})
281316
)(FormComponent);

0 commit comments

Comments
 (0)