Maison > Questions et réponses > le corps du texte
createMarkup() { var row = this.props.row; if (row) { var html='<thead> <tr><th>名称</th><th>值</th></tr></thead><tbody>'; for(var item in row){ html+='<tr><td>'+item+'</td><td><input type="text" id='+item+' value='+row[item]+' onchange={this.handleChange}> </td></tr>'; } html+='</tbody></Table>'; return {__html:html}; } }, handleChange(e) { const value = e.target.getAttribute('id'); const object = {}; object[value] = e.target.value; this.setState(object,function () { console.log(this.state) }); }, render(){ <Table striped bordered condensed hover dangerous lySetInnerHTML={this.createMarkup()}/> } 我想在dangerouslySetInnerHTML的字符串里面的input调用handleChange方法,该如何写