vue-cliとueditorを組み合わせて使用
4683 ワード
ueをダウンロードします.jspバージョンはstaticの下に入れてから
呼び出しueコンポーネント
//ページインスタンス化
import '../../static/Ueditor/ueditor.config'
import '../../static/Ueditor/ueditor.all';
import '../../static/Ueditor/lang/zh-cn/zh-cn';
export default {
name: 'hello',
data () {
return {
ue: '',
uedata: [],
xierudata: []
}
},
mounted() {
this.ue = UE.getEditor('editor',{
toolbars:[['simpleupload']]
});
},
methods: {
//
submits(){
this.uedata.push(UE.getEditor('editor').getContent());
this.$store.state.ueContent=this.uedata.join("
");
console.log(this.$store.state.ueContent);
},
//
xieru(){
const ueText = this.$store.state.ueText;
UE.getEditor('editor').ready(function() {
UE.getEditor('editor').setContent(ueText);
});
}
},
destroyed() {
this.ue.destroy();
}
}
呼び出しueコンポーネント
import uee from '@/components/ueditor';//ue
import {getAesString} from '../../../static/js/aesGet.js'; //
import {getCookie} from '../../../static/js/getCookie.js'; // cookie
export default {
data() {
return
}
},
methods: {
newTraininglive() {
// ue
this.$refs.uee.submits();
},
},
components: {
uee
}
}
//ページインスタンス化
...............
data(){
import '../../../static/Ueditor/ueditor.config'
import '../../../static/Ueditor/ueditor.all';
import '../../../static/Ueditor/lang/zh-cn/zh-cn';
return:{
// ue
ueInfo: "",
uedoSerInfo: "",
relationNews: "",
uedocSerJlInfod: "",
uedocSerJlInfoz: "",
uedocSerJlInfot: "",
}
},
methods:{
fu:(){
// innerHTML , ue
UE.getEditor('genPeople').ready(function() {
UE.getEditor('genPeople').setContent(res.data.dataMap.gys.genPeople);
});
}
},
mounted() {
this.toSupplierFile2();
// ue
this.ueInfo = UE.getEditor('genPeople', {
toolbars: [['insertimage']], //
wordCount: false, //
elementPathEnabled: false, // elementPath
initialFrameHeight: 400, //
});
// ue
this.uedoSerInfo = UE.getEditor('progressHistory', {
toolbars: [['insertimage']], //
wordCount: false, //
elementPathEnabled: false, // elementPath
initialFrameHeight: 400, //
});
// ue
this.relationNews = UE.getEditor('relationNews', {
toolbars: [['insertimage']], //
wordCount: false, //
elementPathEnabled: false, // elementPath
initialFrameHeight: 400, //
});
// ue
this.uedocSerJlInfod = UE.getEditor('relationUnit', {
toolbars: [['insertimage']], //
wordCount: false, //
elementPathEnabled: false, // elementPath
initialFrameHeight: 400, //
});
// ue
this.uedocSerJlInfoz = UE.getEditor('relationImage', {
toolbars: [['insertimage']], //
wordCount: false, //
elementPathEnabled: false, // elementPath
initialFrameHeight: 400, //
});
// ue
this.uedocSerJlInfot = UE.getEditor('other', {
toolbars: [['insertimage']], //
wordCount: false, //
elementPathEnabled: false, // elementPath
initialFrameHeight: 400, //
});
},
destroyed() {
//
this.ueInfo.destroy();
this.uedoSerInfo.destroy();
this.relationNews.destroy();
this.uedocSerJlInfod.destroy();
this.uedocSerJlInfoz.destroy();
this.uedocSerJlInfot.destroy();
this.$destroy();
}