vue中引入ueditor富文本编辑器的方法与遇到的问题及解决方法

下载ueditor

度娘轻松就能找到下载地址,不过我还是放一个:下载地址,因为我后台用的是PHP,所以我下载的是PHP的版本。

使用
  1. 下载下来的东西是一个压缩包,将其解压放在vue项目的static目录,且他的目录如下
    在这里插入图片描述

  2. 找到ueditor.config.js文件,修改其中的配置
    在这里插入图片描述
    这里需要注意的是必须要在utf8-php后面加上/,否则会报错,ueditor富文本框不会显示。
    当然你按照上面的步骤配置后,富文本框是能显示的,但是图片上传功能是不能使用的,控制台报错如下:
    在这里插入图片描述

  3. 我后台是用的PHP,在我的PHP项目中,我也引入了ueditor,所以在vue中我需要做的就是将请求地址指向我PHP项目下的ueditor里
    依旧是在ueditor.config.js文件里:
    在这里插入图片描述

  4. 在我的PHP项目中ueditor的配置如下:
    ueditor.config.js文件下的所有配置我都没有更改
    config.json文件中需要修改如下内容:
    在这里插入图片描述
    划线第一条:图片上传提交地址
    第二条和第三条都有注释(文件本身就有)

  5. 以上就是ueditor的配置,再就是vue中该怎么使用的问题

    1. main.js文件中引入ueditor相关的js文件
      import '../static/utf8-php/ueditor.config'
      import '../static/utf8-php/ueditor.all.js'
      import '../static/utf
  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
为了禁止vue-ueditor-wrap富文本编辑器的编辑功能,你可以在使用组件的地方加上一个属性来禁用编辑。根据引用和引用的代码,你可以在main.js和App.vue添加以下代码: 在main.js: ``` import VueUeditorWrap from 'vue-ueditor-wrap' Vue.component('vue-ueditor-wrap', { ...VueUeditorWrap, props: { disabled: { type: Boolean, default: false } }, mounted: function() { if (this.disabled) { this.$refs.ueditor.setDisabled() } } }) new Vue({ render: h => h(App), }).$mount('#app') ``` 在App.vue: ``` <template> <div id="app"> <VueUeditorWrap :disabled="true"></VueUeditorWrap> </div> </template> <script> import VueUeditorWrap from 'vue-ueditor-wrap' export default { components: { VueUeditorWrap } } </script> ``` 这样设置之后,vue-ueditor-wrap富文本编辑器就会被禁用,用户将无法编辑其的内容。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [vue-ueditor-wrap百度富文本的使用](https://blog.csdn.net/qq_52883064/article/details/129875979)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [vue项目引入vue-ueditor-wrap富文本编辑器](https://blog.csdn.net/weixin_45966674/article/details/123498254)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值