vue-cli中如何集成UEditor 富文本编辑器?
1.根据后台语言下载对应的editor插件版本
地址:https://ueditor.baidu.com/website/download.html
2.将下载好的资源放在/static/ueditor目录下
修改ueditor.config.js配置文件:
《a》指定编辑器资源文件根目录
出现如下错误:后台配置项返回格式出错,上传功能将不能正常使用!
原因没有配置服务器的请求接口
3.将编辑器集成到项目中
《1》src/main.js
import '../static/ueditor/ueditor.config.js'
import '../static/ueditor/ueditor.all.min.js'
import '../static/ueditor/lang/zh-cn/zh-cn.js'
import '../static/ueditor/ueditor.parse.min.js'
《2》src/components/ueditor/index.vue 封装一个公用组件
<template>
<div>
<script id="editor" type="text/plain"></script>
</div>
</template>
<script>
export default {
name: "ue",
data() {
return {
editor: null
};
},
props: {
value: "", //编辑器文字
config: {} //编辑器的配置参数
},
mounted() {
this.editor = window.UE.getEditor("editor", this.config);
this.editor.addListener("ready", () => {
this.editor.setContent(this.value);
});
},
methods: {
getUEContent() {
return this.editor.getContent();
}
},
destroyed() {
this.editor.destroy();
}
};
</script> <style lang='scss' scoped>
</style>
《3》其他页面使用
<template>
<div>
<Uediter :value="ueditor.value" :config="ueditor.config" ref="ue"></Uediter>
<el-button @click="returnContent">显示编辑器内容</el-button>
<div>{{dat.content}}</div>
</div>
</template>
<script>
import Uediter from "@/components/ueditor";
export default {
data() {
return {
dat: {
content: ""
},
ueditor: {
value: "欢迎观看",
config: {
initialFrameWidth: 800,
initialFrameHeight: 320
}
}
};
},
methods: {
returnContent() {
this.dat.content = this.$refs.ue.getUEContent();
}
},
components: {
Uediter
}
};
</script>
通过以上几个步骤即可完成:
vue-cli中如何集成UEditor 富文本编辑器?的更多相关文章
- 在Vue2.0中集成UEditor 富文本编辑器
在vue的'项目中遇到了需要使用富文本编辑器的需求,在github上看了很多vue封装的editor插件,很多对图片上传和视频上传的支持并不是很好,最终还是决定使用UEditor. 这类的文章网上有很 ...
- python3 Django集成Ueditor富文本编辑器
1.下载 python3: https://github.com/twz915/DjangoUeditor3/ (直接下载zip) 2.解压,解压打开后找到DjangoUeditor将DjangoUe ...
- vue集成百度UEditor富文本编辑器
在前端开发的项目中.难免会遇到需要在页面上集成一个富文本编辑器.那么.如果你有这个需求.希望可以帮助到你 vue是前端开发者所追捧的框架,简单易上手,但是基于vue的富文本编辑器大多数太过于精简.于是 ...
- django之百度Ueditor富文本编辑器后台集成
Python3 + Django2.0 百度Ueditor 富文本编辑器的集成 百度富文本编辑器官网地址:http://fex.baidu.com/ueditor/ 疑问:为什么要二次集成? 答案:因 ...
- ASP.NET MVC5 中百度ueditor富文本编辑器的使用
随着网站信息发布内容越来越多,越来越重视美观,富文本编辑就是不可缺少的了,众多编辑器比较后我选了百度的ueditor富文本编辑器. 百度ueditor富文本编辑器分为两种一种是完全版的ueditor, ...
- WEB项目中使用UEditor(富文本编辑器)
Ueditor富文本编辑器是在很多项目里经常用到的框架,是百度开发团队开发的一款很好用的富文本编辑器 下面就是我在一个系统里用到的,有了富文本编辑器,管理员使用起来不是很方便? 所以本博客介绍这个富文 ...
- 前后端分离ueditor富文本编辑器的使用-Java版本
最近在写一个自己的后台管理系统(主要是写着玩的,用来熟悉后端java的知识,目前只是会简单的写点接口),想在项目中编写一个发布新闻文章的功能,想到了使用百度的ueditor富文本编辑器,网上找了很多j ...
- MVC 使用 Ueditor富文本编辑器
一.Ueditor 1.下载Ueditor富文本编辑器 官方下载地址: http://ueditor.baidu.com/website/download.html 建议下载开发版,此处我下载的是 . ...
- 百度ueditor富文本编辑器的使用
百度ueditor富文本编辑器的使用 //以下为我在官网下载的ueditor v1.3.5 php版的大楷配置步骤第一步: //配置文件的引入应该比功能文件先引入,最后设置语言类型.即:editor. ...
随机推荐
- gdb调试3_显示变量 和 数组
http://www.cnblogs.com/shipfi/archive/2008/08/04/1260293.html 感谢作者! 程序变量查看文件中某变量的值:file::variablefu ...
- 【Asp.net入门4-02】使用Visual Studio调试器
- django中的转义
什么是html转义? 所谓html转义就是将 html关键字(包括标签,特殊字符等) 进行过滤替换.过滤替换格式如下: 接下来我们通过实例演示django中转义的细节以及如何关闭转义 一 dja ...
- ICPC 2015 Shenyang Online-E-EXCITED DATAbase
题目描述 She says that any Pavarotti among the nightingales will serenade his mate while she sits on her ...
- poj 3216 Repairing Company
http://poj.org/problem?id=3216 n个地点,m个任务 每个任务有工作地点,开始时间,持续时间 最少派多少人可以完成所有的任务 传递闭包之后最小路径覆盖 #include&l ...
- Golang入门教程(一)GOPATH与工作空间(Windows)
https://github.com/astaxie/build-web-application-with-golang/blob/master/zh/01.2.md Windows 环境: 下面我就 ...
- JS替换地址栏参数值
首先,页面引入JS代码片段(整体复制粘贴即可): var Query=function(a){"use strict";var b=function(a){var b=[],c,d ...
- javascript 高度相关
//scrollTop; var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop); ...
- 收集了一些python的文章
来自: 戴铭 2010-08-31 17:52:31 newthreading - safer concurrency for Python 安全并发(1回应) http://www.starming ...
- 2016.6.21——Climbing Stairs
Climbing Stairs 本题收获: 1.斐波那契函数f(n) = f(n-1) + f(n -2) 题目: You are climbing a stair case. It takes n ...