我正在使用react-medium-editor(https://github.com/wangzuo/react-medium-editor),编辑器中的文字永远不会空白
handleChange=(text)=>{
this.setState({text: text});
}
Submit(){
this.setState({text: ''});
}
render(){
return(
<div>
<Editor
text={this.state.text}
onChange={this.handleChange}
options={{placeholder: {text: "Write your response here"},
toolbar: {buttons: ['bold', 'italic', 'underline'],
}}} />
<button onClick={this.Submit.bind(this)}></button>
</div>
)
}
当我点击按钮时,this.setState将Text的值设置为空白,但编辑器文本永远不会变为空白。
如何通过设置状态使编辑器值变为空白。
答案 0 :(得分:0)
进行最后一次提交或在此处显示编辑器。我无法测试它。 (或指定发生这种分支)