|
@@ -1,5 +1,8 @@
|
|
<template>
|
|
<template>
|
|
- <div ref="editor" style="text-align:left"></div>
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <div ref="editor" style="text-align:left"></div>
|
|
|
|
+ <el-button type="" @click="toClick">test</el-button>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
import E from 'wangeditor';
|
|
import E from 'wangeditor';
|
|
@@ -34,10 +37,12 @@ export default {
|
|
},
|
|
},
|
|
props: {
|
|
props: {
|
|
value: { type: String, required: false, default: '' },
|
|
value: { type: String, required: false, default: '' },
|
|
|
|
+ url: { type: String },
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
editorContent: this.value,
|
|
editorContent: this.value,
|
|
|
|
+ editor: {},
|
|
};
|
|
};
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
@@ -49,7 +54,7 @@ export default {
|
|
// 自定义菜单配置
|
|
// 自定义菜单配置
|
|
editor.customConfig.menus = menus;
|
|
editor.customConfig.menus = menus;
|
|
editor.customConfig.zIndex = 0;
|
|
editor.customConfig.zIndex = 0;
|
|
- editor.customConfig.uploadImgServer = '/files/cms/images/upload';
|
|
|
|
|
|
+ editor.customConfig.uploadImgServer = this.url;
|
|
editor.customConfig.uploadImgMaxLength = 1;
|
|
editor.customConfig.uploadImgMaxLength = 1;
|
|
editor.customConfig.uploadImgHooks = {
|
|
editor.customConfig.uploadImgHooks = {
|
|
// 如果服务器端返回的不是 {errno:0, data: [...]} 这种格式,可使用该配置
|
|
// 如果服务器端返回的不是 {errno:0, data: [...]} 这种格式,可使用该配置
|
|
@@ -67,11 +72,15 @@ export default {
|
|
};
|
|
};
|
|
editor.create();
|
|
editor.create();
|
|
editor.txt.html(this.value);
|
|
editor.txt.html(this.value);
|
|
|
|
+ this.$set(this, 'editor', editor);
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
getContent: function() {
|
|
getContent: function() {
|
|
return this.editorContent;
|
|
return this.editorContent;
|
|
},
|
|
},
|
|
|
|
+ toClick() {
|
|
|
|
+ console.log(this.editor);
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|