diff --git a/src/components/ReDialog/index.vue b/src/components/ReDialog/index.vue index aa9ad3834..15b6c1073 100644 --- a/src/components/ReDialog/index.vue +++ b/src/components/ReDialog/index.vue @@ -64,9 +64,10 @@ const fullscreenClass = computed(() => { function eventsCallBack( event: EventType, options: DialogOptions, - index: number + index: number, + isClickFullScreen = false ) { - fullscreen.value = options?.fullscreen ?? false; + if (!isClickFullScreen) fullscreen.value = options?.fullscreen ?? false; if (options?.[event] && isFunction(options?.[event])) { return options?.[event]({ options, index }); } @@ -108,7 +109,17 @@ function handleClose( void; -type EventType = "open" | "close" | "openAutoFocus" | "closeAutoFocus"; +type EventType = + | "open" + | "close" + | "openAutoFocus" + | "closeAutoFocus" + | "fullscreenCallBack"; type ArgsType = { /** `cancel` 点击取消按钮、`sure` 点击确定按钮、`close` 点击右上角关闭按钮或空白页或按下了esc键 */ command: "cancel" | "sure" | "close"; @@ -175,6 +180,14 @@ interface DialogOptions extends DialogProps { index: number; args: any; }) => void; + /** 点击全屏按钮时的回调 */ + fullscreenCallBack?: ({ + options, + index + }: { + options: DialogOptions; + index: number; + }) => void; /** 输入焦点聚焦在 `Dialog` 内容时的回调 */ openAutoFocus?: ({ options, diff --git a/src/views/components/dialog/index.vue b/src/views/components/dialog/index.vue index 0df0df694..5a8f59e04 100644 --- a/src/views/components/dialog/index.vue +++ b/src/views/components/dialog/index.vue @@ -43,9 +43,11 @@ function onFullscreenClick() { function onFullscreenIconClick() { addDialog({ - title: "全屏按钮", + title: "全屏按钮和全屏事件", fullscreenIcon: true, - contentRenderer: () =>

弹框内容-全屏按钮

+ fullscreenCallBack: ({ options, index }) => + message(options.fullscreen ? "全屏" : "非全屏"), + contentRenderer: () =>

弹框内容-全屏按钮和全屏事件

}); } @@ -468,7 +470,7 @@ function onBeforeSureClick() { 基础用法 可拖拽 全屏 - 全屏按钮 + 全屏按钮和全屏事件 无背景遮罩层 自定义弹出位置 延时2秒打开弹框