<template>
    <div>
        <quill-editor ref="myTextEditor" v-model="content" :options="editorOption" style="height:600px;"></quill-editor>
    </div>
</template>
<script>
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
import { quillEditor } from 'vue-quill-editor';
import axios from 'axios'
export default {
    data(){
        return{
            content: '',
            editorOption: {
               placeholder: '编辑文章内容'
             },
        }
    },
    components: {
        quillEditor
    },
    mounted(){
        axios({
                method: 'get',
                url: '/api',
                header: {
                    'content-type': 'text/html;charset=gb2312',
                },
            })
                .then((response) => {
                    console.log(response, 'res');
                    console.log(response.data, 'res');
                    this.myContent = response.data
                    this.content = response.data
                })
                .catch((error) => {
                    console.log(error);
                });
    },
    methods:{
        onEditorChange({ editor, html, text }) {
            this.content = html;
        },
        
    }
}
</script>