in my admin app I have an , inside this component I also have Vue 2's quill rich editor which uses v-model for its data, now I want to pass the v-model from my child vue-2-editor to my own parent component, the docs say you can have custom v-model in yur compoennt with props value and emiting an 'input' event with that value, but how can I pass one v-model to another, from child to parent component.
Im using vue 2 editor, A text editor using Vue.js and Quill: https://github.com/davidroyer/vue2-editor
My component :
<template>
<div style="width:auto; height:auto; display:flex; flex-direction.column;">
<button @click="editorVisible = true">Show Editor</button>
<vue-editor v-model="value" :editorToolbar="customToolbar" useCustomImageHandler @imageAdded="handleImageAdded"></vue-editor>
</div>
</template>
<!--SCRIPTS-->
<script>
import { VueEditor } from 'vue2-editor';
export default {
name: 'ADMINeditor',
props:
{
value:{ required:true, type:String }
},
data()
{
return {
editorVisible:false
}
},
methods:
{
wrote()
{
this.$emit('input', this.value);
}
}
}
</script>
<!--STYLES-->
<style scoped>
</style>
I want to be able to do:
<admin-editor v-model="text"></admin-editor>
More info about -model in custom components.