项目记录

163 阅读1分钟

新增和编辑用同一个弹窗

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,

            })

        }

微信截图_20210907151852.png