5.el表达式
dataSource = (userPage, orgList) =>
userPage.map(item => {
const org = orgList.find(org => org.orgId === item.ORG_ID);
return {
...item,
measuresName: item.MEASURES_NAME,
measuresId: item.MEASURES_ID,
unitedId: item.UNITED_ID,
orgId: item.ORG_ID,
//oUl.style.display == "block" ? oUl.style.display="none" : oUl.style.display="block"
unitedType: item.UNITED_TYPE =='black' ? '黑名单' : '红名单',
orgName: org ? org.orgName : item.ORG_ID,
key: item.MEASURES_ID
};
});
4.react中自定义完成某个操作后,跳转到列表展示界面
let promise; promise = this.props.personalService.updatePersonalMesages(myUser);//进行和后台交互的接口调用
//完成交互后,进行通过修改浏览器链接地址的形式,切换路由到想要的界面去
//Utils是自己封装的一个工具函数
promise.then(data => { Utils.pushLink(`/profile/main`); })
3 If using forceUpdate() is discouraged, how should components react to change events in the model? (2017-05-11)
// user.js export default class User extends EventEmitter { constructor(args) { super(); this.id = args.id; this.isActivated = args.isActivated || false; } activate() { this.isActivated = true; this.emit('change'); } } // UserView.jsx export default class UserView extends React.Component { componentDidMount() { this.props.user.on('change', this.onUserUpdate); } onUserUpdate() { this.forceUpdate(); } render ( var user = this.props.user; return ( <div> <span>User {user.isActivated ? 'is' : 'is not'} activated.</span> <button onClick={user.activate()}>Activate</button> </div> ); ); } // app.js var user = new User({ id: 123 }); ReactDOM.render(<UserView user={user} />, container);
2。2017-05-11 15:03:46
<FormItem {...formItemLayout} label="性别" hasFeedback > {getFieldDecorator('sex', { initialValue: signUser.sex })( <RadioGroup> <Radio key="M" value='M'>男</Radio> <Radio key="F" value='F'>女</Radio> <Radio key="U" value='U'>暂未设置</Radio> <Radio key="F1" value='F1'>女</Radio> </RadioGroup> )} </FormItem>
//去掉 hasFeedback 就没有狗狗了
1.关于一个路由里面如果有重复的路由指向,路由加载不同的组件,那么测试结果是:系统会自动识别第一个路由指向的对应组件;
<Route path="user/:id" name="用户详细" component={UserDetail}/> <Route path="user/:id" name="编辑用户" component={UserManagementDetail}/> //解决方案: <Route path="user/:id" name="用户详细" component={UserDetail}/> <Route path="users/:id" name="编辑用户" component={UserManagementDetail}/>