富文本编辑器——百度UEditor插件Vue组件化
来源:互联网 发布:如何优化课堂教学 编辑:程序博客网 时间:2024/05/16 09:39
1、百度UEditor插件的安装过程请查看我的另篇博文:http://blog.csdn.net/lzc4869/article/details/78438121
2、组件
(1)组件页面
ueditor.vue
<template> <script :id=id type="text/plain"></script></template><script> export default { name: 'UE', data() { return { editor: null } }, props: { content: { type: String, default:'' }, config: { type: Object, }, id: { type: String } }, ready() { const _this = this; _this.editor = UE.getEditor(_this.id, _this.config); // 初始化UE _this.editor.addListener("ready", function () { _this.editor.setContent(_this.content); // 确保UE加载完成后,放入内容。 }); }, methods: { getContent() { // 获取内容方法 return this.editor.getContent(); } }, destroyed() { this.editor.destroy(); }, }</script>
(2)测试页面
test_ue.vue
<template> <div class="content-wrapper"> <div class="content"> <div class="info">UE编辑器示例<br>需要使用编辑器时,调用UE公共组件即可。可设置填充内容content,配置信息config(宽度和高度等),可调用组件中获取内容的方法。支持页面内多次调用。 </div> <button @click="getUEContent()">获取内容</button> <ueditor :content=content1 :config=config1 :id="ue1"></ueditor> <ueditor :content=content2 :config=config2 :id="ue2"></ueditor> </div> </div></template><script> import ueditor from '../common/component/ueditor.vue'; export default { components: { ueditor }, data() { return { content1: '这里是UE测试1', content2: '这里是UE测试2', config1: { initialFrameWidth: 1600, initialFrameHeight: 350, wordCount: false, }, config2: { autoHeight: false, wordCount: false, }, ue1: "ue1", // 不同编辑器必须不同的id ue2: "ue2" } }, methods: { getUEContent() { // 获取ueditor值 let content1 = UE.getEditor(this.ue1).getContent(); let content2 = UE.getEditor(this.ue2).getContent(); console.log(content1) console.log(content2) } } };</script>
阅读全文
1 0
- 富文本编辑器——百度UEditor插件Vue组件化
- 富文本编辑器——百度UEditor插件安装教程
- vue集成百度UEditor富文本编辑器
- 百度富文本编辑器UEditor
- 百度富文本编辑器UEditor
- 富文本编辑器百度ueditor
- 百度富文本编辑器UEditor
- 编辑器 UEditor 百度富文本web编辑器
- 百度富文本编辑器ueditor使用总结
- 百度富文本编辑器ueditor使用
- 百度富文本编辑器ueditor使用总结
- 百度富文本编辑器Ueditor的使用
- 百度富文本编辑器ueditor使用小结
- 百度Ueditor富文本编辑器上传图片
- 百度Ueditor富文本编辑器的使用
- 百度ueditor富文本--自定义插件按钮
- 百度UEditor富文本
- 富文本编辑器ueditor
- dumpsys命令的用法
- 一些数据API接口
- SQL UPDATE
- Java + ffmpeg + mencoder + Windows 转码为mp4 H.264
- 国内外自然语言处理(NLP)研究组
- 富文本编辑器——百度UEditor插件Vue组件化
- python 操作MySQL数据库使用"insert into ... on duplicate key update"报错问题
- 【bzoj 3675】序列分割(斜率优化DP)
- leetcode 第2题
- Vue开发跨端应用(三)添加cordova
- cocos2d-x中文乱码问题解决
- Eureka 源码解析 —— 应用实例注册发现(五)之过期
- Git 状态 untracked 和 not staged的区别
- DispatchServlet调用栈