react中的坑

9.

渲染界面的时候让滚动条回到顶部
//渲染界面的时候让滚动条回到顶部
    componentDidMount() {
        window.scrollTo(0,0);
    }

路由:
<Route path="aboutMain" name="关于我们" component={AboutMain}/>

8.img标签需要闭合   2016-11-16   14:44:40

  编译通不过

正确写法:<img  />

<img src="/assets/img/indexImage/statistical.png" />

7.map()遍历数组操作说明?

  • map:和forEach非常相似,都是用来遍历数组中的每一项值的,用来遍历数组中的每一项;
  • 区别:map的回调函数中支持return返回值;return的是啥,相当于把数组中的这一项变为啥(并不影响原来的数组,只是相当于把原数组克隆一份,把克隆的这一份的数组中的对应项改变了);
  • 不管是forEach还是map 都支持第二个参数值,第二个参数的意思是把匿名回调函数中的this进行修改。
 
var ary = [12,23,24,42,1];
var res = ary.map(function (item,index,input) {
     return item*10;
})
console.log(res);//-->[120,230,240,420,10];
console.log(ary);//-->[12,23,24,42,1];

参考地址:http://www.cnblogs.com/jocyci/p/5508279.html

6.react antd Transfer 怎么初始化? 2016-11-03

5.如何判断一个数据源是map还是json?(如何判断一个数据是map还是json对象?) 2016-10-31

4.map和json 怎么互相转换? 2016-10-31

3.map对象和json区别? 2016-10-31

1.react from 表单无法获取用户输入的值?


//取值操作
handleSubmit(e) {
e.preventDefault();
const value = this.props.form.getFieldsValue();
console.log('控制台打印收到表单值:', this.props.form.getFieldsValue());
this.props.form.validateFieldsAndScroll((errors, values) => {
console.log(values);
if (!!errors) {
console.log('Errors in form!!!');
return;
}
//表单通过前端验证后,可以和后台交互通信了
console.log('Submit!!!');
console.log(values);
});
}


// 对应的表单上要绑定
<Form   form={this.props.form}>

//......


</Form>

2.dispatch(actionErrorCreator(resp.data || { errCode: resp.status, errMsg: resp.statusText }));—— resp is undefined

原文地址:https://www.cnblogs.com/zxyun/p/6004493.html