使用 ReactJs ,我想在地图功能的回调中插入$('.ws-table-list').on('click', 'th', function() {
console.log('click'); // This only runs once in the console
$('span', this).toggleClass('glyphicon-menu-up glyphicon-menu-down');
});
,但我找不到方法。
this
答案 0 :(得分:0)
使用.bind
修复
render:function()
var DateTimeField = require('react-bootstrap-datetimepicker');
console.log(this);
console.log(123);
var cards = this.state.nameWithQualifier.map(function (card,this) {
return (
<div >
<div className={"panel panel-primary" + this.state.workState}>
<div className={ "panel-body " + card.insertTime } >
<label className="col-md-9 checkbox-inline">
<input type="checkbox" className={card.insertTime} ></input>
{card.insertText}
</label>
<div className="col-md-3"> DeadLine : {card.insertTime}</div>
</div>
</div>
</div>
);}.bind(this));