import {reactive} from 'vue'
import type { DialogModel } from "@/type/BastType";
export default function useDialog(){
    //定义弹框属性
    const dialog = reactive<DialogModel>({
        title:'',
        visible:false,
        width:630,
        height:280,
        confirmLoading: false
    })

    //展示
    const onShow = () =>{
        dialog.visible = true;
    }

    //关闭
    const onClose = () =>{
        dialog.visible =false;
    }

    //确定
    const onConfirm = () =>{
        dialog.visible = false;
    }

    const setLoading = (loading: boolean) => {
        dialog.confirmLoading = loading
    }

    return {
        dialog,
        onShow,
        onClose,
        onConfirm,
        setLoading
    }
}