Home > Web Front-end > H5 Tutorial > body text

How to use ueditor in vue project

php中世界最好的语言
Release: 2018-03-27 14:55:22
Original
3120 people have browsed it

This time I will show you how to use ueditor in the vue project. What are the precautions for using ueditor in the vue project? The following is a practical case, let's take a look.

Take the project generated by vue-cli as an example

1. Put the ueditor file in the 1.static folder first

2.index.html add the following code

<script type="text/javascript" charset="utf-8" src="static/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="static/ueditor/ueditor.all.min.js"></script>
Copy after login

3.webpack.base.conf.js add the following Configure

externals: {
  'UE': 'UE',
 },
Copy after login

4.index.html and add the

<script type="text/javascript">
 window.UEDITOR_HOME_URL = "/static/ueditor/";//配置路径设定为UEditor所放的位置
</script>
Copy after login

5.editor component

<template>
 <p>
  <mt-button @click="geteditor()" type="danger">获取</mt-button>
  <script id="editor" type="text/plain" style="width:1024px;height:500px;"></script>
 </p>
</template>
<script>
const UE = require('UE');// eslint-disable-line
export default {
 name: 'editorView',
 data: () => (
  {
   editor: null,
  }
 ),
 methods: {
  geteditor() {
   console.log(this.editor.getContent());
  },
 },
 mounted() {
  this.editor = UE.getEditor('editor');
 },
 destroyed() {
  this.editor.destroy();
 },
};
</script>
<style>
</style>
Copy after login
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How Canvas makes a 3D dynamic Chart

How WebGL operates json and echarts charts

The above is the detailed content of How to use ueditor in vue project. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template