{individual && individual.map((el)=>{
return (
<a href="#" data-toggle="modal" data-target="#responsive-modal" className="btn btn-success waves-effect waves-light m-t-20">UnSubscribe</a>
<div id="responsive-modal" className="modal fade emp-add-list" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style={{display: "none"}}>
<div className="modal-dialog">
<div className="modal-content">
<div className="modal-body">
<div className="form-group">
<div className="checkbox">
<button type="button" className="btn btn-danger" onClick={this.withdrawPlan.bind(this, el)}>Withdraw Plan</button>
</div>
</div>
</div>
</div>
</div>
</div>
)
})
}
withdrawPlan(el){
let data = {
subscription_plan_id: 'SP5bd18b12b144f81f341a72ed',
reason: this.state.withdrawl_reason
}
UserAction._planWithdrawl(data);
}
我有一个退订unsubscribe
的按钮,我可以获取所有el
数据,如何在模式中访问el
数据,单击取款计划后,我需要访问el数据。
答案 0 :(得分:0)
如果我正确理解它。 首先,为什么在模板中有方法?
您不需要锚标签。您可以通过函数以模态形式获取数据
<button href="#" data-toggle="modal" data-target="#responsive-modal" onClick={()=>this.myFunction(el)} className="btn btn-success waves-effect waves-light m-t-20">UnSubscribe</button>
在我的函数中,将数据保存为状态并从那里触发模式。您的状态应该是
this.state = { enableModal:否, 数据:空 }