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