vue 使用百度编辑器ueditor
来源:互联网 发布:全国地区代码表 sql 编辑:程序博客网 时间:2024/06/03 11:27
1、先从百度管网下载资源 http://ueditor.baidu.com/website/download.html ,然后解压到静态资源 static(和src同级) 文件中,然后在 单独起一个组件 UE.vue
<template> <div> <script id="editor" type="text/plain"></script> </div></template><script>import '../../../static/utf8-jsp/ueditor.config.js' //根据自己文件的路径接入import '../../../static/utf8-jsp/ueditor.all.min.js'import '../../../static/utf8-jsp/lang/zh-cn/zh-cn.js'import '../../../static/utf8-jsp/ueditor.parse.min.js' export default { name: 'UE', data () { return { editor: null } }, mounted() { const _this = this; this.editor = UE.getEditor('editor', { BaseUrl: '', UEDITOR_HOME_URL: this.url_head + '/static/utf8-jsp/', //这个是静态资源的路径 // toolbars:[] //编辑器里需要用的功能 }); // 初始化UE this.editor.addListener("ready", function () { _this.editor.setContent(''); // 确保UE加载完成后,放入内容。 }); console.log(this.text); }, methods: { getUEContent() { // 获取内容方法 return this.editor.getContent() }, testMsg(){ const _this = this; this.defaultMsg = this.text; console.log(this.defaultMsg); this.editor.setContent(this.defaultMsg); // 确保UE加载完成后,放入内容。 } }, watch : { 'text' : 'testMsg' }, props : ['text'], //接收传过来的文章 destroyed() { this.editor.destroy(); } }</script><style type="text/css"> #editor{height: 500px;}</style>
2、在需要用的地方接入 UE.vue 组件 ,根据内容给编辑器传递参数
<template><UE :text="addData.text" ref="ueBox"></UE></template>
import UE from '../page/UE.vue';export default{data(){return{ uedata: [], addData : {text : '123',},imgDataUrl : '',formLabelWidth : '140px'}},methods : {parentClick(){this.addData.text = '21312312'}},mounted : function() {},components : {UE,}}
打开 ueditor.config.js 文件,在里面找到
window.UEDITOR_CONFIG = { //为编辑器实例添加一个路径,这个不能被注释 UEDITOR_HOME_URL: URL // 服务器统一请求接口路径 // , serverUrl: URL + "jsp/controller.jsp" //改掉它…………}
阅读全文
0 0
- vue 使用百度编辑器ueditor
- 百度编辑器 UEditor 使用
- 百度编辑器UEditor使用
- vue集成百度UEditor富文本编辑器
- 百度编辑器ueditor的使用
- 百度编辑器-UEditor使用注意
- 百度编辑器UEditor 简单使用
- 百度编辑器UEditor 简单使用
- yii 百度编辑器Ueditor使用
- 如何使用百度编辑器ueditor
- 百度编辑器ueditor使用视频教程
- 百度编辑器UEditor 简单使用
- 使用百度Ueditor在线文本编辑器心得
- 百度富文本编辑器ueditor使用总结
- 百度编辑器ueditor的简单使用
- 百度编辑器ueditor的简单使用
- Ueditor(百度编辑器)的使用
- 百度编辑器ueditor的简单使用
- 欢迎使用CSDN-markdown编辑器
- 基于私有云的数据库高可用架构实践
- lnmp环境搭建
- 【笔记】php数字格式(1)- str_pad
- 解决动态高度的iframe加载后双滚动条的问题
- vue 使用百度编辑器ueditor
- Struts2
- prml读书笔记-第二章
- 6.17
- Java经典算法50题
- mysql数据库数据迁移步骤
- python简单入门教程(day1)
- 第十四周项目一
- Java 数据类型