restructure/src/components/Modal/index.vue

62 lines
1.1 KiB
Vue
Raw Normal View History

2022-05-24 09:09:30 +08:00
<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>