标签:无效 ops func name obj let nbsp for map
var RechargeBtnEle = React.createClass({ getInitialState: function() { return {id:0}; }, handleClick(item,item1){ console.log(item,item1) }, render(){ let btnArr = this.props.data var newArr = [] for(let i=0;i<btnArr.length;i++){ var item = btnArr[i] let styleObj = this.state.id==item.id?["recharge","btn","btn-default","btn-sm","selected"].join(‘ ‘):["recharge","btn","btn-default","btn-sm"].join(" ") newArr.push( <div className={styleObj} onClick={this.handleClick.bind(this.item,item)} >{`${item.diamond}钻石`}</div> ) } return( <div className="charge-btn"> {newArr} </div> ) } })
28.React使用map循环创建对象绑定click无效解决方法
标签:无效 ops func name obj let nbsp for map
原文地址:http://www.cnblogs.com/famLiu/p/7284318.html