<template>
  <n-modal v-model:show="getModalOptions" preset="dialog">
    <n-card>
      <slot name="Context" />
    </n-card>
  </n-modal>
</template>

<script>

import { defineComponent, computed } from 'vue'
export default defineComponent({
  name: 'ModalModules',
  props: {
    /* 弹窗可见 */
    visible: {
      type: Boolean,
      default: false
    },
    /* 弹窗标题 */
    title: {
      type: String,
      default: ''
    },
    /* 确定按钮的loading */
    confirmLoading: {
      type: Boolean,
      default: false
    },
    maskClosable: {
      type: Boolean,
      default: true
    }
  },
  emits: {
    click: null, // click事件没有检验
    onClose: (value) => {
      return value
    }
  },
  setup(props, { emit }) {
    const getModalOptions = computed(() => {
      return props.visible
    })
    const handleClick = function() {
      emit('click')
    }
    const handleCancel = function() {
      emit('onClose', true)
    }
    return {
      getModalOptions,
      handleClick,
      handleCancel
    }
  }
})
</script>

<style scoped lang='scss'>
</style>
