new Vue({
el: '#app',
data:{
editor:null,
text: ''
},
mounted(){
this.editor = new Quill(
this.$el.querySelector('.qeditor'),
{theme: 'snow'}
)
// set the content
let initcontent = { ops: [{ insert: '' }, { attributes: { header: 1 }, insert: '\n' }] }
this.editor.setContents(initcontent)
// update back the content from editor
this.editor.on('text-change', (delta, oldDelta, source) => {
// if you want to store the Quill source
let quillsrc = this.editor.getContents()
// if you want to render the HTML
this.text = this.editor.root.innerHTML
})
}
})