1.关于页面之间传值:
<Link to= {{pathname: '/路径',
state: {参数:this.state.selectedRows}
}}>
另外一个传递的页面取值方式:this.props.location.state.参数
2.关于点击事件跳转页面:
在Models中先配置(dva使用)
首先引入 import { routerRedux } from 'dva/router';
*redirect({ payload }, { put }) {
const params = {
pathname: '/sample_registration', //要跳转的地址
state: payload,
}
yield put(routerRedux.push(params));
},
最后在页面方法中直接调用即可.
handle(obj){
this.props.dispatch({ type: 'resultInput/dataEntry',payload:obj})
}
3.关于箭头函数的问题:
ES5:传入参数的形式:
1.foo.call(obj,33) //直接从第二个参数开始,依次传入
2.foo.apply(obj,[33]) //第二个参数必须是数组,传入放在数组里
bind的特点:绑定完this不会立即调用当前的函数,而是将函数返回
bind传参的方式同call一样
ES6:箭头函数:当只有一个形参的时候括号可以省略