vue開發中富文本編輯器的使用技巧

vue開發中富文本編輯器的使用技巧

一、在vue中引入tinymce

npm install @tinymce/tinymce-vue -S

可是一直無法下載成功,我就直接找了資源

可以直接點這兒下載

將下載好的 tinymce 腳本庫放到你的項目的static目錄下面

二、配置HTML變量

在 你的項目/build/webpack.dev.conf.js 中添加如下配置:

templateParameters: {

BASE_URL: config.dev.assetsPublicPath + config.dev.assetsSubDirectory

}


目的:為了在html頁面中能夠使用這裡定義的BASE_URL變量

三、引入js腳本

由於富文本編輯器是第三方提供的,需要把它的腳本引入進來才能使用。

在 你的項目/index.html,也就是程序的入口文件中引入js腳本

1

目前提供瞭如下幾個屬性:

PropertyDescriptionTypeDefault

idComponent unique identifierStringDefault to help you generate a unique id

valueRich text contentStringOnly monitor changes once

toolbarRich text toolbarArray[]

menubarRich text menubarString‘file edit insert view format table’

heightRich text heightNumber360

widthRich text widthNumber, String/


分享到:


相關文章: