1、安裝
npm install --save-dev vue2-ace-editor
2.1、全局加載:main.js 進行組件全局加載
import Editor from 'vue2-ace-editor'
Vue.component('editor', Editor)
2.2、組件單獨加載
import Editor from 'vue2-ace-editor'
components: {
Editor
}
3、組件引入editor代碼編輯器
<editor height="500" width="500" ref="editor" :content="content" v-model="content" :options="{ enableBasicAutocompletion: true, enableSnippets: true, enableLiveAutocompletion: true, tabSize:6, fontSize:14, showPrintMargin:false, //去除編輯器里的豎線 }" :lang="'html'" @init="editorInit"> </editor>
--僅用作學習記錄