第一步,安装依赖,并且把ueditor整个文件夹放入public里边

第二步,在你需要编辑的地方引入,或者main.js中全局引入

XX.vue文件中写入下面代码,创建编辑器。

<vue-ueditor-wrap v-model="form.content" :config="myConfig" @ready='ueditor'></vue-ueditor-wrap>

 第三步,在script中引入

import VueUeditorWrap from 'vue-ueditor-wrap'

第四步,在export default {}中加入

omponents: { VueUeditorWrap },

然后在data(){}中添加工具栏等配置文件

第五步,在methods:{}中配置请求参数,以携带token啥的

    ueditor (ueditor) {
ueditor.execCommand('serverparam', ueditor => {
return {
userToken: window.sessionStorage.getItem('userToken'),
Rtoken: window.sessionStorage.getItem('Rtoken')
}
})

完整配置

<template>
<vue-ueditor-wrap v-model="form.content" :config="myConfig" @ready='ueditor'></vue-ueditor-wrap>
</template> <script>
import VueUeditorWrap from 'vue-ueditor-wrap'
export default {
name: 'ueditor',
omponents: { VueUeditorWrap },
data () {
return {
myConfig: {
serverUrl: '',
UEDITOR_HOME_URL: '/editor/',
autoHeightEnabled: true,
autoFloatEnabled: false,
initialFrameHeight: 540,
initialFrameWidth: '100%',
maximumWords: 2000,
enableAutoSave: true,
toolbars: [[
'fontfamily', // 字体
'fontsize',
'bold', // 加粗
'indent', // 首行缩进
'justifyleft', // 居左对齐
'justifyright', // 居右对齐
'justifycenter', // 居中对齐
'forecolor',
'link',
'insertorderedlist',
'insertunorderedlist',
'insertcode',
'spechars', // 特殊字符
'pagebreak', // 分页
'attachment', // 附件
'imagecenter', // 居中
'wordimage', // 图片转存
'time',
'date' ]]
}
}
},
methods: {
ueditor (ueditor) {
ueditor.execCommand('serverparam', ueditor => {
return {
userToken: window.sessionStorage.getItem('userToken'),
Rtoken: window.sessionStorage.getItem('Rtoken')
}
})
}
}
}
</script>

最新文章

  1. 请写一个php函数,可以接受任意数量的参数
  2. C#窗体-&gt;&gt;随机四则运算
  3. hiho1099_constellation
  4. 【kate总结】matlab调用opencv总结
  5. 【高斯消元】Poj 1222:EXTENDED LIGHTS OUT
  6. Visual Studio中的一些较大的文件的作用
  7. linux 多核
  8. 四维dp 或者 剪枝 + dfs Codeforces Beta Round #6 (Div. 2 Only) D
  9. 计算机 计算机语言 常见的DOS命令
  10. [0] C#异常种类
  11. Python学习—框架篇之初识Django
  12. window下安装PIL
  13. 强大的JQuery表单验证插件 FormValidator使用介绍
  14. mark一下岗位
  15. 用TexturePacker打图集用于UGUI中
  16. redis 超时失效key 的监听触发
  17. [javaSE] 网络编程(URL)
  18. Action的方法访问
  19. Continuous Subarray Sum II(LintCode)
  20. atitit.《金刚经》与it软件项目管理的启发 读后感attilax

热门文章

  1. ASPNET Core笔试题
  2. android studio 初印象
  3. VS无线振弦采集仪的常见问题
  4. k8s+crio+podman搭建集群
  5. 云ATM架构设计
  6. 【每天学一点-05】使用umi.js代理,解决跨域问题(前端)
  7. Java开发学习(二十一)----Spring事务简介与事务角色解析
  8. Vue3 computed &amp;&amp; watch(watchEffect)
  9. springboot的@ConditionalOnClass注解
  10. Java学习 (四)基础篇 Java基础语法