<template>
    <div class="dialog-wrap" v-if="show">
        <div class="dialog">
            <slot />
        </div>
      </div>
</template>

<script>
export default {
    data() {
        return {
            show: false
        }
    },
    props: {
        title: {
            type: String,
            defoult: '提示'
        },
        visible: {
            type: Boolean,
            type: false
        }
    },
    methods: {
        close() {
            this.show = false
            this.$emit('close')
        }
    },
    created() {
        this.show = this.visible
    },
    watch: {
        visible() {
            this.show = this.visible
        }
    }
}
</script>

<style scoped lang="scss">
.dialog-wrap {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba($color: #000000, $alpha: 0.7);
    z-index: 100;
    .dialog {
        position: absolute;
        left: 50%;
        top: 40%;
        transform: translate(-50%, -50%);
    }
}
</style>
