Use ueditor Rich Text Editor and vueueditor in vue

Source: Internet
Author: User

Use ueditor Rich Text Editor and vueueditor in vue

I recently used the rich text editor when I was working on the background management system. Finally, select ueditor, which is used by my project.Vue + vuex + vue-router + webpack + elementUITo build the framework,

1, download the UEditor official website of the latest jsp version of the package, download decompress the package to get a utf8-jsp folder, which contains the following content:

2. Change this folder to ueditor and move it to the static folder in your project. modify the content in the ueditor. config. js folder, for example:

3. Write child components

<Template> <div: id = "id" type = "text/plain"> </div> </template> <script> import '.. /.. /.. /static/ueditor. config. js 'import '.. /.. /.. /static/ueditor. all. min. js 'import '.. /.. /.. /static/ueditor/lang/zh-cn/zh-cn.js 'import '.. /.. /.. /static/ueditor. parse. min. js 'export default {name: 'ue', data () {return {editor: null }}, props: {defaultMsg: {type: String, default: 'Enter the content '}, Config: {type: Object}, id: {type: String, default: 'UE $ {Math. random (0,100)} '}}, mounted () {this. $ nextTick () => {this. editor = UE. getEditor (this. id, this. config); // initialize UE this. editor. addListener ("ready", () => {this.editor.exe cCommand ('insertml', this. defaultMsg); this. editor. focus () // After the UE is loaded, place the content. })}, Methods: {getUEContent () {// return this. editor. getContent ()}, clearContent () {// clear the editor content return this.editor.exe cCommand ('cleardoc ') ;},}, beforeDestroy () {// when the component is destroyed, to destroy the UEditor instance if (this. editor! = Null & this. editor. destroy) {this. editor. destroy () ;}}</script> <style scoped> </style>

4. Use it in the parent component

<UE :config="configEditor" :id="ue1" ref="ue" :defaultMsg="val"></UE>

5. After the configuration is completed, the backend configuration item http Error will be prompted during image uploading, and an upload error will be prompted during file uploading. Here, do not declare that after the ueditor is configured on the front end, it needs to work with the back end, and then configure the ueditor. config. change the serverUrl prefix in js to your own backend Access Request Path.

ServerUrl: "unified request address"


The above section describes how to use the ueditor Rich Text Editor in the vue. I hope it will help you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.