|
@@ -28,7 +28,6 @@ export const loadingError = () => {
|
|
|
/**
|
|
/**
|
|
|
* * render 对话框
|
|
* * render 对话框
|
|
|
* @param { Object} params 配置参数, 详见 https://www.naiveui.com/zh-CN/light/components/dialog
|
|
* @param { Object} params 配置参数, 详见 https://www.naiveui.com/zh-CN/light/components/dialog
|
|
|
- * @param { Function } dialogFn 函数
|
|
|
|
|
* ```
|
|
* ```
|
|
|
* 最简易的 demo
|
|
* 最简易的 demo
|
|
|
* goDialog({
|
|
* goDialog({
|
|
@@ -36,7 +35,7 @@ export const loadingError = () => {
|
|
|
* })
|
|
* })
|
|
|
* ```
|
|
* ```
|
|
|
*/
|
|
*/
|
|
|
-export const goDialog = (
|
|
|
|
|
|
|
+ export const goDialog = (
|
|
|
params: {
|
|
params: {
|
|
|
// 基本
|
|
// 基本
|
|
|
type?: DialogEnum
|
|
type?: DialogEnum
|
|
@@ -44,14 +43,12 @@ export const goDialog = (
|
|
|
title?: string | (() => any)
|
|
title?: string | (() => any)
|
|
|
// 提示
|
|
// 提示
|
|
|
message?: string
|
|
message?: string
|
|
|
- // 取消提示词
|
|
|
|
|
- negativeText?: string
|
|
|
|
|
- // 取消按钮的属性
|
|
|
|
|
- negativeButtonProps?: object,
|
|
|
|
|
// 确定提示词
|
|
// 确定提示词
|
|
|
positiveText?: string
|
|
positiveText?: string
|
|
|
- // 确定按钮的属性
|
|
|
|
|
- positiveButtonProps?: object,
|
|
|
|
|
|
|
+ // 取消提示词
|
|
|
|
|
+ negativeText?: string
|
|
|
|
|
+ // 是否不展示取消按钮
|
|
|
|
|
+ closeNegativeText?: boolean,
|
|
|
// 点击遮罩是否关闭
|
|
// 点击遮罩是否关闭
|
|
|
isMaskClosable?: boolean
|
|
isMaskClosable?: boolean
|
|
|
// 回调
|
|
// 回调
|
|
@@ -61,17 +58,16 @@ export const goDialog = (
|
|
|
promise?: boolean
|
|
promise?: boolean
|
|
|
promiseResCallback?: Function
|
|
promiseResCallback?: Function
|
|
|
promiseRejCallback?: Function
|
|
promiseRejCallback?: Function
|
|
|
- },
|
|
|
|
|
- dialogFn?: Function
|
|
|
|
|
|
|
+ [T:string]: any
|
|
|
|
|
+ }
|
|
|
) => {
|
|
) => {
|
|
|
const {
|
|
const {
|
|
|
type,
|
|
type,
|
|
|
title,
|
|
title,
|
|
|
message,
|
|
message,
|
|
|
- negativeText,
|
|
|
|
|
- negativeButtonProps,
|
|
|
|
|
positiveText,
|
|
positiveText,
|
|
|
- positiveButtonProps,
|
|
|
|
|
|
|
+ negativeText,
|
|
|
|
|
+ closeNegativeText,
|
|
|
isMaskClosable,
|
|
isMaskClosable,
|
|
|
onPositiveCallback,
|
|
onPositiveCallback,
|
|
|
onNegativeCallback,
|
|
onNegativeCallback,
|
|
@@ -83,7 +79,7 @@ export const goDialog = (
|
|
|
const typeObj = {
|
|
const typeObj = {
|
|
|
// 自定义
|
|
// 自定义
|
|
|
[DialogEnum.DELETE]: {
|
|
[DialogEnum.DELETE]: {
|
|
|
- fn: dialogFn || window['$dialog'].warning,
|
|
|
|
|
|
|
+ fn: window['$dialog'].warning,
|
|
|
message: message || '是否删除此数据?'
|
|
message: message || '是否删除此数据?'
|
|
|
},
|
|
},
|
|
|
// 原有
|
|
// 原有
|
|
@@ -108,7 +104,7 @@ export const goDialog = (
|
|
|
icon: renderIcon(InformationCircleIcon, { size: dialogIconSize }),
|
|
icon: renderIcon(InformationCircleIcon, { size: dialogIconSize }),
|
|
|
content: typeObj[type || DialogEnum.WARNING]['message'],
|
|
content: typeObj[type || DialogEnum.WARNING]['message'],
|
|
|
positiveText: positiveText || '确定',
|
|
positiveText: positiveText || '确定',
|
|
|
- negativeText: negativeText || '取消',
|
|
|
|
|
|
|
+ negativeText: closeNegativeText ? undefined : (negativeText || '取消'),
|
|
|
// 是否通过遮罩关闭
|
|
// 是否通过遮罩关闭
|
|
|
maskClosable: isMaskClosable || maskClosable,
|
|
maskClosable: isMaskClosable || maskClosable,
|
|
|
onPositiveClick: async () => {
|
|
onPositiveClick: async () => {
|