1. 程式人生 > >vue 引入ckeditor 方式

vue 引入ckeditor 方式

1 引入ckeditor.js檔案到index.html

2 (1)可以直接通過 npm i vue-ckeditor 安裝,安裝後再webpack.base.conf.js 裡面module.export配置 

externals: {

"CKEDITOR": "window.CKEDITOR"

},

2 (2) 也可以 不使用vue-ckeditor,直接

  <div class="ckeditor">

    <textarea :id="id" :value="value"></textarea>

  </div>

在mounted()初始化,具體一些細節操作,看ckeditor文件

CKEDITOR.replace(ckeditorId, ckeditorConfig)

CKEDITOR.instances[ckeditorId].setData(this.value)