I want to implement an editing operation. When I enter the page, I get the data from the background and insert the data into the rich text box. The
data is requested, but the official method editor.txt.html () fails to insert the data into the text box.
here is a screenshot and the code:
the red arrow refers to the data I requested, that is, the data I want to insert into the text box, but I don"t know why it is empty
Code
Code in HTML
<el-form :model="quizData" ref="testForm">
<el-form-item label="" required>
<br>
<div ref="editor" style="text-align:left"></div>
{{this.quizData.quizTitle}}
</el-form-item>
</el-form>
data request in create
created () {
this.getQuizInfo()
//getQuizInfomethods
getQuizInfo () {
quizInfo().then(res=>{
this.quizData = res.data
})
},
},
data structure of quizData
quizData:{
"quizId": 0,
quizTitle: "",
quizType: 0,
"updateTime": "2018-11-28T03:10:25.082Z",
},
text box initialization in mounted
mounted() {
var editor = new E(this.$refs.editor)
editor.customConfig.onchange = (html) =>{
console.log(html)
this.quizData.quizTitle = html
}
editor.customConfig.menus = [
"head", //
]
editor.create()
editor.txt.html(this.quizData.quizTitle)
},