使用vue-cli构建项目,在组件当中import ueditor 初始化很慢,有时还会初始化失败
请问有没有遇到过类似的问题?能否提供解决思路或方案?
发现每次初始化成功都会加载一些js、css文件,是否因为加载文件网络慢导致的?文件在本地服务器。
very much Thanks in advance~~~
<script id="content" class="content" type="text/plain"></script>
created () {
this.editor = UE.getEditor('content')
// test code
var d = 1
var dd = setInterval(function() {
d++
console.log(d)
}, 1000)
this.editor.ready((editor) => {
this.editor.execCommand('focus');
console.log('加载时间: ' + d + '秒');
clearInterval(dd)
})
},
destroyed () {
this.editor.destroy()
}
先检查你的ueditor该不会是引用的线上的资源吧。
ueditor这种应该属于公共组件,你把它放到项目中当作小组件用,每次启动webpack的打包会比较冗杂。
你应该需要的是这个,我曾经的一篇博客,你参考下:
http://www.anchengjian.com/#/...