Vue之vue2-ace-editor代碼編輯器使用方式


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>

 --僅用作學習記錄


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM