提交 1986f61e authored 作者: vipcxj's avatar vipcxj

1.修复独立model组件命名空间重复和不能正常销毁的问题。

2.修改代理服务器为本体测试服务器
上级 e4c1aa5f
const proxy = {
"target": "http://192.168.1.121:1180",
"target": "http://192.168.1.116:1180",
"changeOrigin": true,
"pathRewrite": {
"^/api": "/houseServer/restful-services"
......
......@@ -4,19 +4,28 @@ import _, { startsWith } from 'lodash';
import { getApp } from '../../data/app';
const connect = (modelCreator, { app, mapStateToProps, mapDispatchToProps, mergeProps, options }) => (Comp) => {
const { name, model } = modelCreator();
const { dispatchVar, namespaceVar } = (options || {});
class StatefulComponent extends Component {
constructor(props, context) {
super(props, context);
const { name, model } = modelCreator();
this.name = name;
this.model = model;
}
componentWillMount() {
(app || this.props.app || getApp()).model(model);
(app || this.props.app || getApp()).model(this.model);
}
componentWillUnmount() {
(app || this.props.app || getApp()).unmodel(model);
(app || this.props.app || getApp()).unmodel(this.model.namespace);
}
render() {
const { children, ...rest } = this.props;
const name = this.name;
const model = this.model;
const mapState = (state) => {
const props = mapStateToProps ? mapStateToProps(state) : {};
props[name] = state[model.namespace];
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论