This commit is contained in:
Pan 2018-11-28 10:57:15 +08:00
parent ead385ee50
commit 011dec91f7
2 changed files with 13 additions and 2 deletions

View File

@ -12,7 +12,7 @@ import Editor from 'tui-editor'
import defaultOptions from './defaultOptions' import defaultOptions from './defaultOptions'
export default { export default {
name: 'SimplemdeMd', name: 'MarddownEditor',
props: { props: {
value: { value: {
type: String, type: String,
@ -46,6 +46,11 @@ export default {
default: 'en_US' // https://github.com/nhnent/tui.editor/tree/master/src/js/langs default: 'en_US' // https://github.com/nhnent/tui.editor/tree/master/src/js/langs
} }
}, },
data() {
return {
editor: null
}
},
computed: { computed: {
editorOptions() { editorOptions() {
const options = Object.assign({}, defaultOptions, this.options) const options = Object.assign({}, defaultOptions, this.options)
@ -64,6 +69,12 @@ export default {
language(val) { language(val) {
this.destroyEditor() this.destroyEditor()
this.initEditor() this.initEditor()
},
height(newValue) {
this.editor.height(newValue)
},
mode(newValue) {
this.editor.changeMode(newValue)
} }
}, },
mounted() { mounted() {

View File

@ -28,7 +28,7 @@
<div class="editor-container"> <div class="editor-container">
<el-tag class="tag-title">I18n:</el-tag> <el-tag class="tag-title">I18n:</el-tag>
<el-alert title="You can change admin global language to see the effect" type="success"/> <el-alert :closable="false" title="You can change the language of the admin system to see the effect" type="success"/>
<markdown-editor v-model="content" :language="language" height="300px"/> <markdown-editor v-model="content" :language="language" height="300px"/>
</div> </div>