<template>
    <Dialog :btnType="btnType" :btnName="btnName" :title="title" :onConfirm="onSubmit.bind(this, form)" @closed="handleClear">
        <Form v-model="form">
            <slot></slot>
        </Form>
    </Dialog>
</template>

<script>
import Dialog from '../Dialog.vue'
import Form from './Form.vue'

export default {
    name: 'DialogForm',
    components: {Dialog, Form},
    props: {
        // Dialog属性
        btnType: {
            type: String,
            default: 'primary'
        },
        btnName: {
            type: String,
            default: '打开弹窗'
        },
        title:{
            type: String
        },
        onSubmit:{
            type: Function
        }
    },
    data(){
        return {
            form: {
                selections: []
            }
        }
    },
    methods: {
        handleClear(){
            this.form.selections = []
        }
    }
}
</script>

<style>

</style>