我是靠谱客的博主 时尚酒窝,这篇文章主要介绍vue项目中如何使用ueditor,现在分享给大家,希望可以做个参考。

这次给大家带来vue项目中如何使用ueditor,vue项目中使用ueditor的注意事项有哪些,下面就是实战案例,一起来看一下。

以vue-cli生成的项目为例

1.static文件夹下先放入ueditor文件

2.index.html添加如下代码

复制代码
1
2
<script type="text/javascript" charset="utf-8" src="static/ueditor/ueditor.config.js"></script> <script type="text/javascript" charset="utf-8" src="static/ueditor/ueditor.all.min.js"></script>
登录后复制

3.webpack.base.conf.js添加如下配置

复制代码
1
2
3
externals: { 'UE': 'UE', },
登录后复制

4.index.html中添加

复制代码
1
2
3
<script type="text/javascript"> window.UEDITOR_HOME_URL = "/static/ueditor/";//配置路径设定为UEditor所放的位置 </script>
登录后复制

5.editor组件

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<template> <p> <mt-button @click="geteditor()" type="danger">获取</mt-button> <script id="editor" type="text/plain" style="width:1024px;height:500px;"></script> </p> </template> <script> const UE = require('UE');// eslint-disable-line export default { name: 'editorView', data: () => ( { editor: null, } ), methods: { geteditor() { console.log(this.editor.getContent()); }, }, mounted() { this.editor = UE.getEditor('editor'); }, destroyed() { this.editor.destroy(); }, }; </script> <style> </style>
登录后复制

相信看了本文案例你已经掌握了方法,更多精彩请关注靠谱客其它相关文章!

推荐阅读:

Canvas如何做出3D动态的Chart图表

WebGL怎样操作json与echarts图表

以上就是vue项目中如何使用ueditor的详细内容,更多请关注靠谱客其它相关文章!

最后

以上就是时尚酒窝最近收集整理的关于vue项目中如何使用ueditor的全部内容,更多相关vue项目中如何使用ueditor内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(131)

评论列表共有 0 条评论

立即
投稿
返回
顶部