mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-24 00:02:51 +08:00
chore: 修改发布文案提示,修改 dialog 全局封装
This commit is contained in:
parent
741ba1a039
commit
8b57ffa124
@ -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 () => {
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { shallowReactive } from 'vue'
|
||||
import { renderIcon, fetchPathByName, routerTurnByPath, setSessionStorage, getLocalStorage } from '@/utils'
|
||||
import { renderIcon, goDialog, fetchPathByName, routerTurnByPath, setSessionStorage, getLocalStorage } from '@/utils'
|
||||
import { PreviewEnum } from '@/enums/pageEnum'
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
import { useRoute } from 'vue-router'
|
||||
@ -55,7 +55,12 @@ const previewHandle = () => {
|
||||
|
||||
// 发布
|
||||
const sendHandle = () => {
|
||||
window['$message'].warning('该功能暂未实现(因为压根没有后台)')
|
||||
goDialog({
|
||||
message: '想体验发布功能,请前往 master-fetch 分支查看: https://gitee.com/MTrun/go-view/tree/master-fetch',
|
||||
positiveText: '了然',
|
||||
closeNegativeText: true,
|
||||
onPositiveCallback: () => {}
|
||||
})
|
||||
}
|
||||
|
||||
const btnList = shallowReactive([
|
||||
|
Loading…
Reference in New Issue
Block a user