Commit a49b2b1b72245c7530e27b7ce04e299eade00399

Authored by Min
1 parent 00fc8d20

1.补充代码注释

Showing 1 changed file with 3 additions and 14 deletions
src/routes/mes/indexMes.js
@@ -2,6 +2,7 @@ import React from "react"; @@ -2,6 +2,7 @@ import React from "react";
2 import { connect } from "dva"; // 全局状态管理 2 import { connect } from "dva"; // 全局状态管理
3 import IndexMesComponent from "@/mes/indexMes"; 3 import IndexMesComponent from "@/mes/indexMes";
4 4
  5 +// 创建路由包装器组件
5 export const IndexMesRoute = ({ 6 export const IndexMesRoute = ({
6 dispatch, 7 dispatch,
7 app, 8 app,
@@ -18,23 +19,11 @@ export const IndexMesRoute = ({ @@ -18,23 +19,11 @@ export const IndexMesRoute = ({
18 formRoute, 19 formRoute,
19 sModelType 20 sModelType
20 }; 21 };
21 - 22 + // 将业务组件包装并传递所有props
22 return <IndexMesComponent {...props} />; 23 return <IndexMesComponent {...props} />;
23 }; 24 };
24 - 25 +// 将全局状态映射到组件props
25 const mapStateToProps = props => props; 26 const mapStateToProps = props => props;
26 -/* props:  
27 - {  
28 - 'model1的namespace': 储存的值,  
29 - 'model2的namespace': 储存的值,  
30 - ...  
31 - }  
32 - 因为在src/index.js 中引用的model 为app和content,所以这边返回的是  
33 - {  
34 - app: {...},  
35 - content: {...},  
36 - }  
37 -*/  
38 27
39 // 用connect包装会默认传dispatch到组件中 28 // 用connect包装会默认传dispatch到组件中
40 // mapStateToProps会把返回的数据传到组件中(这里指app、content) 29 // mapStateToProps会把返回的数据传到组件中(这里指app、content)