vue + UEditor 开发第一次什么反应都没有 刷新后才会加载出来
UEditor 组件
<template>
<script :id=id type="text/plain"></script>
</template>
<script>
import * as _ from '../util/tool';
export default {
name: 'UE',
data () {
return {
editor: null,
flag:true,
}
},
props: {
defaultMsg: {
type: String
},
config: {
type: Object
},
id: {
type: String
}
},
activated() {
this.init();
},
methods: {
init(){
if(!UE.Editor.prototype._bkGetActionUrl){
UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;//修改图片上传地址
UE.Editor.prototype.getActionUrl = function(action) {
if (action == 'uploadimage' || action == 'uploadscrawl' || action == 'uploadfile' || action =='uploadvideo') {
return '/ueditor/upload.html';
} else {
return this._bkGetActionUrl.call(this, action);
}
};
};
let _this = this;
this.editor = UE.getEditor(_this.id, _this.config); // 初始化UE
},
getUEContent() { // 获取内容
return this.editor.getContent()
},
setUEContent(val) { // 设置内容
return this.editor.setContent(val);
},
getUEContentText(){ // 获取纯文本内容
return this.editor.getContentTxt();
},
destroyed(){
return this.editor.destroy();
}
},
deactivated() {
//销毁编辑器实例,使用textarea代替
//this.editor.destroy()
//重置编辑器,可用来做多个tab使用同一个编辑器实例
//如果要使用同一个实例,请注释destroy()方法
this.editor.reset()
}
}
</script>
组件中调用
~ ~ ~
data(){
return {
Ueditor: 'ue1',
config: {
initialFrameWidth: null,
initialFrameHeight: 350
},
}
}
~ ~ ~
<UE ref="bdeditor" :id="Ueditor" :config=config></UE>
但是我重新登录后会什么都不显示
刷新后会显示出来
会不会和缓存有关系
各位大佬帮我看一下
activated keep-alive组件激活时调用 免不了是这个缘故