[Vuejs]-Quill modules in Nuxt.js

0👍

nuxt-quill-plugin.js

import Vue from 'vue'
import VueQuillEditor from 'vue-quill-editor'

Vue.use(VueQuillEditor)

nuxt.config.js

import webpack from 'webpack'
export default {

build: {
        plugins: [
        new webpack.ProvidePlugin({
            'window.Quill': 'quill/dist/quill.js',
            'Quill': 'quill/dist/quill.js'
        }),
        ]
      }
}

page.vue

<template>
    <div>
<quill-editor
    v-model="content"
    :options="editorOption"
    />
</div>
</template>

<script>

import Editor from '~/components/Editor' 
export default {
data() {
return {
content: '<p>I am Example</p>',
editorOption: {
            // Some Quill options...
            theme: 'snow',
            modules: {
                    toolbar: [
                        ['bold', 'italic', 'underline', 'strike'],
                        ['blockquote', 'code-block']
                    ]
                }
            }
}
}
}
</script>

Leave a comment