新增和编辑用同一个弹窗
index.vue
<template>
<div class="px-10">
<Modal
@register="register"
></Modal>
</div>
</template>
import BasicModal from '/@/components/Modal/src/BasicModal.vue';
// 引入弹窗
import Modal from './components/Modal.vue'
// 弹窗配置
const [register,{ openModal }] = useModal();
function handleCreate(){
openModal(true, {
create: true,
});
}
async function handleDelete(record){
await DELETE_PLAN({id: record.id})
reload()
message.success(t('routes.basic.toast.successDelete'))
}
// 编辑
const handleEdit = (row) => {
openModal(true, {
create: false,
row,
})
}