一開始選用了tinymce
,遇到的問題以下:css
https://github.com/PanJiaChen/vue-element-admin
ivew
的Modal
彈窗中,不能編輯,工具欄能夠點擊,可是編輯區域點了沒反應接下來我投入了Vue2-editor的懷抱,本地開發一塊兒順利 基本配置以下:html
<vue-editor id="editor1" v-model="content" :editorToolbar="customToolbar"></vue-editor>
<vue-editor id="editor2" v-model="addContent" :editorToolbar="customToolbar"></vue-editor>
複製代碼
customToolbar: [
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[{ 'header': 1 }, { 'header': 2 }],
[{ 'align': [] }],
['bold', 'italic', 'underline', 'strike'],
[{ 'list': 'ordered' }, { 'list': 'bullet' }]
],
複製代碼
可是提測後,報錯vue
TypeError: e.isBuffer is not a function at d (vue2-editor.js:1) at n (vue2-editor.js:1) at t.value (vue2-editor.js:1) at new t (vue2-editor.js:1) at new t (vue2-editor.js:1) at a.setQuillElement (vue2-editor.js:1) at a.initializeVue2Editor (vue2-editor.js:1) at a.mounted (vue2-editor.js:1) at Dt (vue.esm.js:2921) at Object.insert (vue.esm.js:4158) vue.esm.js:1741 TypeError: Cannot read property 'innerHTML' of null at a.value (vue2-editor.js:1) at wa.run (vue.esm.js:3233) at Rt (vue.esm.js:2981) at Array.<anonymous> (vue.esm.js:1837) at at (vue.esm.js:1758) 複製代碼
在官網看到了這個issues
,題目是:Production Build is breaking Vue2-editor #104
,日期爲2018-5-18
,尚未解決方案,只好放棄git
此issues連接:https://github.com/davidroyer/vue2-editor/issues/104
github
Vue-quill-editor
主要使用方式參考了此博客 https://blog.csdn.net/div_ma/article/details/79536634c
npm
npm install vue-quill-editor --save
main.js
中引入import VueQuillEditor from 'vue-quill-editor'
// require styles 引入樣式
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
// 富文本編輯器
Vue.use(VueQuillEditor)
複製代碼
<quill-editor v-model="addContent" :options="editorOption" >
</quill-editor>
複製代碼
import { quillEditor } from 'vue-quill-editor'
components: { quillEditor },
editorOption: {
modules: {
toolbar: [
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[{ 'header': 1 }, { 'header': 2 }],
[{ 'align': [] }],
['bold', 'italic', 'underline', 'strike'],
[{ 'list': 'ordered' }, { 'list': 'bullet' }]
]
}
},
複製代碼
提測後沒有報錯了,開心bash
5月24號更新編輯器
ql-editor
,才能正常顯示<div class="preface-text ql-editor" v-html="report.foreword">
複製代碼