UEditor is a javascript rich text editor of Baidu, with powerful functions, the following is the introduction process in the vue project
1. Download vue-ueditor-wrap:
Note: Downloading this plug-in is easy to use for vue, has the advantage of two-way data binding, and the operation is relatively convenient.
The first step, first download dependencies
npm and vue-ueditor-wrap -S
The second step is to introduce it into the project (I introduced it to the required page, there is no global introduction)
import VueUeditorWrap from 'vue-ueditor-wrap'
The third step is to register the component
import VueUeditorWrap from 'vue-ueditor-wrap'
The fourth step is to use components in the template
<template> <div> <VueUeditorWrap/> </div> </template>
2. Download the official compressed package provided by ueditor:
Download address: https://ueditor.baidu.com/website/download.html
3. Put the downloaded official compressed package under static or public:
If the project uses vue-cil2.0 version, it will be placed in static, if it is vue-cil3.0 version, it will be placed in the public folder
4, modify the reference
<VueUeditorWrap :config="editorConfig" v-model="formData.Remark" />
editorConfig: { autoHeightEnabled: false , // The compiler is not automatically propped up by the content initialFrameHeight: 350 , // The initial container height initialFrameWith: " 100% " , serverUrl: " /api/ueditor/net/controller.ashx " , // Upload file address UEDITOR_HOME_URL: " / UEditor / " , // Storage path of UEditor resource file },
At this point, the configuration is complete
In view of the second entry page will report " ueditor TypeError: Cannot set property 'innerHTML' of null" "
This problem can be modified by ueditor source code ueditor.all.js