本文摘自PHP中文网,作者php中世界最好的语言,侵删。
这次给大家带来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/" ;
</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' );
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>
|
相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!
阅读剩余部分
相关阅读 >>
a标签如何使用href属性与onclick事件
html(css+div)使用集锦 看完你就会了
如何使用h5的dataset
html里的事件怎么使用
在h5里手机端页面缩放应该如何实现
html如何2d和3d转换
html的meta标签应该如何使用
html的table鼠标拖拽排序该如何实现
html元素(标签)大全及使用介绍
html图片的img标签怎样使用
更多相关阅读请进入《ueditor》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » vue项目中如何使用ueditor