From 8b57ffa1244f14d5bd82a447a04fa8c39fe2b099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Sat, 4 Jun 2022 16:17:11 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=96=87=E6=A1=88=E6=8F=90=E7=A4=BA=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=20dialog=20=E5=85=A8=E5=B1=80=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/plugin.ts | 24 ++++++++----------- .../ContentHeader/headerRightBtn/index.vue | 9 +++++-- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/utils/plugin.ts b/src/utils/plugin.ts index 5b4e7e09..6b3a86ab 100644 --- a/src/utils/plugin.ts +++ b/src/utils/plugin.ts @@ -28,7 +28,6 @@ export const loadingError = () => { /** * * render 对话框 * @param { Object} params 配置参数, 详见 https://www.naiveui.com/zh-CN/light/components/dialog - * @param { Function } dialogFn 函数 * ``` * 最简易的 demo * goDialog({ @@ -44,14 +43,12 @@ export const goDialog = ( title?: string | (() => any) // 提示 message?: string - // 取消提示词 - negativeText?: string - // 取消按钮的属性 - negativeButtonProps?: object, // 确定提示词 positiveText?: string - // 确定按钮的属性 - positiveButtonProps?: object, + // 取消提示词 + negativeText?: string + // 是否不展示取消按钮 + closeNegativeText?: boolean, // 点击遮罩是否关闭 isMaskClosable?: boolean // 回调 @@ -61,17 +58,16 @@ export const goDialog = ( promise?: boolean promiseResCallback?: Function promiseRejCallback?: Function - }, - dialogFn?: Function + [T:string]: any + } ) => { const { type, title, message, - negativeText, - negativeButtonProps, positiveText, - positiveButtonProps, + negativeText, + closeNegativeText, isMaskClosable, onPositiveCallback, onNegativeCallback, @@ -83,7 +79,7 @@ export const goDialog = ( const typeObj = { // 自定义 [DialogEnum.DELETE]: { - fn: dialogFn || window['$dialog'].warning, + fn: window['$dialog'].warning, message: message || '是否删除此数据?' }, // 原有 @@ -108,7 +104,7 @@ export const goDialog = ( icon: renderIcon(InformationCircleIcon, { size: dialogIconSize }), content: typeObj[type || DialogEnum.WARNING]['message'], positiveText: positiveText || '确定', - negativeText: negativeText || '取消', + negativeText: closeNegativeText ? undefined : (negativeText || '取消'), // 是否通过遮罩关闭 maskClosable: isMaskClosable || maskClosable, onPositiveClick: async () => { diff --git a/src/views/chart/ContentHeader/headerRightBtn/index.vue b/src/views/chart/ContentHeader/headerRightBtn/index.vue index 463508d6..b92a86de 100644 --- a/src/views/chart/ContentHeader/headerRightBtn/index.vue +++ b/src/views/chart/ContentHeader/headerRightBtn/index.vue @@ -11,7 +11,7 @@