Error on plugin quill occurred when i placed the editor in a tab container of Vuetify. It is created under the mounted hook.
The error in Console is
quill Invalid Quill container undefined
[Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'on' of undefined"
Below is the vue file.
<template>
<v-app class="panel" ref="panel">
<v-tabs fixed-tabs v-model="tab">
<v-tabs-slider></v-tabs-slider>
<v-tab key="1" href="#tab1">
Tab 1
</v-tab>
<v-tab key="2" href="#tab2">
Tab 2
</v-tab>
<v-tabs-items v-model="tab">
<v-tab-item key="1" value="tab1">
<div class="formPanel" ref="formPanel">
<div class="title-text" ref="title">Edit text in tab 1</div>
<div ref="editor" v-html="value"></div>
</div>
</v-tab-item>
<v-tab-item key="2" value="tab2">
<v-card-text>This is tab 2</v-card-text>
</v-tab-item>
</v-tabs-items>
</v-tabs>
</v-app>
</template>
<script>
import Quill from 'quill';
export default {
data: function () {
return {
tab: 'editor'
};
},
mounted() {
var toolbarOptions = [
['bold', 'italic', 'underline', 'strike'],
[{ 'size': ['small', false, 'large', 'huge'] }],
];
this.editor = new Quill(this.$refs.editor, {
modules: { toolbar: toolbarOptions },
placeholder: 'Edit text',
theme: 'snow'
});
},
};
</script>
<style scoped>
</style>