vue+quill-editor 富文本框 使用

1、npm install quill-editor -- save

2、添加組件

<quill-editor v-model="content"

? ? ? ? ? ? ? ref="myQuillEditor"

? ? ? ? ? ? ? :options="editorOption"

? ? ? ? ? ? ? @blur="onEditorBlur($event)"

? ? ? ? ? ? ? @focus="onEditorFocus($event)"

? ? ? ? ? ? ? @ready="onEditorReady($event)"

? ? ? ? ? ? ? @change="onEditorChange">

</quill-editor>

3、引入相關(guān)文件及script

import 'quill/dist/quill.core.css'

import 'quill/dist/quill.snow.css'

import 'quill/dist/quill.bubble.css'

import {quillEditor}from 'vue-quill-editor'

export default {

components: {

quillEditor

},

? ? data () {

return {

? ? ? ? ? ? content:'',

? ? ? ? ? ? editorOption:{}

};

? ? },

? ? methods: {

onEditorBlur(quill) {

// console.log('editor blur!', quill)

? ? ? ? },

? ? ? ? onEditorFocus(quill) {

// console.log('editor focus!', quill)

? ? ? ? },

? ? ? ? onEditorReady(quill) {

// console.log('editor ready!', quill)

? ? ? ? },

? ? ? ? onEditorChange({ quill, html, text }) {

// console.log('editor change!', quill, html, text)

? ? ? ? ? ? this.content = html

}

},

? ? computed: {

editor() {

return this.$refs.myQuillEditor.quill

? ? ? ? }

},

}

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容