<template>
  <el-dialog v-dialogDrag :close-on-click-moda="false" :title="title" :visible.sync="show" width="40%" :close-on-click-modal="false" :before-close="doClose">
    <quill-editor v-model="content" placeholder="请输入内容" />
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" @click="doInput">确 定</el-button>
      <el-button @click="show = false">取 消</el-button>
    </span>
  </el-dialog>
</template>

<script>

export default {
    data() {
        return {
            show: false,
            content: '',
            node: {
                model: {},
                prop: ''
            }
        };
    },
    computed: {
        title() {
            return '富文本输入';
        }
    },
    methods: {
        doShow(node) {
            this.node = node;
            this.content = (node.model || {})[node.prop] || '';
            this.show = true;
        },
        doClose(done) {
            this.show = false;
        },
        doInput() {
            const node = this.node;
            node.model[node.prop] = this.content;
            this.doClose();
        }
    }
};
</script>
