<!-- Reference: https://github.com/StefanNeuser/vuejs2-summernote-component/blob/master/src/Summernote.js -->
<template>
<textarea v-if="model" :name="name">{{ model }}</textarea>
</template>
<script>
module.exports = {
props: {
model: {
required: true,
},
name: {
type: String,
},
height: {
default: '400'
}
},
mounted() {
let config = {
height: this.height
};
let vm = this;
config.callbacks = {
onInit: function () {
$(vm.$el).summernote("code", vm.model);
},
onChange: function () {
vm.$emit('update:model', $(vm.$el).summernote('code'));
},
onBlur: function () {
vm.$emit('update:model', $(vm.$el).summernote('code'));
}
};
$(this.$el).summernote(config);
}
}
</script>
<style scoped>
</style>