Files
d2-admin-start-kit/src/components/d2-ueditor/index.vue
T
liyang d07d15ed8c D2Admin 1.7
Former-commit-id: 3010ce31114fdc121006451c72f9e18306239fd2
2019-05-07 09:26:18 +08:00

51 lines
894 B
Vue

<template>
<vue-ueditor-wrap
ref="ueditor"
v-model="currentValue"
:config="config"
:destroy="true"
:init="init"/>
</template>
<script>
// 参考 https://github.com/HaoChuan9421/vue-ueditor-wrap
import config from './ueditor.config'
import buttonD2admin from './button/d2admin'
export default {
props: {
value: {
type: String,
default: ''
}
},
data () {
return {
config,
currentValue: ''
}
},
watch: {
// 对外提供 v-model
value: {
handler (val) {
if (this.currentValue !== val) {
this.currentValue = val
}
},
immediate: true
},
// 对外提供 v-model
currentValue (val) {
this.$emit('input', val)
}
},
methods: {
init () {
// 注册一个测试按钮
this.$refs.ueditor.registerButton(buttonD2admin)
}
}
}
</script>