以vue-cli生成的項目為例
1.static文件夾下先放入ueditor文件
2.index.html添加如下代碼
<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添加如下配置
externals: { 'UE': 'UE', },
4.index.html中添加
<script type="text/javascript"> window.UEDITOR_HOME_URL = "/static/ueditor/";//配置路徑設定為UEditor所放的位置 </script>
5.editor組件
<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>
相信看了本文案例你已經掌握了方法,更多精彩請關注Gxl網其它相關文章!
推薦閱讀:
Canvas如何做出3D動態的Chart圖表
WebGL怎樣操作json與echarts圖表
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com