使用ES6的时候,用class创建组件,class中的方法并不会自动把this绑定到示例中,针对以上,有以下几种方法来进行绑定1:使用.bind(this)2:使用箭头函数 =>3:将绑定方法写到constructor中