|
|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <textarea id="tiny" v-model="content"></textarea>
|
|
|
+ <textarea v-model="content" ref="editor"></textarea>
|
|
|
</template>
|
|
|
<script>
|
|
|
import axios from 'axios';
|
|
|
@@ -38,7 +38,7 @@
|
|
|
},
|
|
|
mounted() {
|
|
|
tinymce.init({
|
|
|
- selector: '#tiny',
|
|
|
+ target: this.$refs.editor,
|
|
|
skin_url: '/static/skins/lightgray',
|
|
|
language: 'zh_CN',
|
|
|
menubar: false,
|
|
|
@@ -68,6 +68,8 @@
|
|
|
})
|
|
|
},
|
|
|
init_instance_callback: editor => {
|
|
|
+ this.editor = editor;
|
|
|
+ this.editor.setContent(this.content);
|
|
|
editor.on('Change MouseOut', e => {
|
|
|
this.content = editor.getContent();
|
|
|
});
|
|
|
@@ -76,12 +78,16 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ editor: null,
|
|
|
content: ''
|
|
|
}
|
|
|
},
|
|
|
methods: {},
|
|
|
watch: {
|
|
|
value(val) {
|
|
|
+ if (this.editor) {
|
|
|
+ this.editor.setContent(val);
|
|
|
+ }
|
|
|
this.content = val
|
|
|
},
|
|
|
content(val) {
|