MessageBox在message中添加点击事件,做个记录

import { ElNotification, ElMessageBox, ElAlert,ElMessage,ElForm, ElFormItem, ElButton } from 'element-plus'
import { ref, reactive, computed, watch, h } from 'vue'

ElMessageBox({
   title: '是否全部加入清单',
   confirmButtonText: '确定',
   cancelButtonText: '取消',
   showCancelButton: true,
   dangerouslyUseHTMLString: true,
   message: h('div', { style: "position:relative" }, [
             h('div', null, `14天内已选择调出但仍在店铺内的skc可批量加入清单中`),
             h('div', null, `共计: ${filterSkc.value}个skc, 库存${filterCalcActualQty}件`),
             h('div', { style: "margin-top:1vw;" }, [
               h(ElButton, { onClick: noTip, id: 'codeId' }, '不再提醒')
              ])
             ])
}).then(()=>{
   queryDataSure()
}).catch(()=>{
                
})

参考:element-plus中ElmessageBox弹窗内容进行vnode操作_elmessagebox使用-CSDN博客

  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
下面是一个简单的实现思路: 1. 定义一个全局变量来记录当前弹窗的页数。 ``` int page = 1; ``` 2. 创建一个自定义的窗口类,用于显示弹窗内容。在窗口添加一个按钮,用于触发下一页的更新操作。 ``` class MyPopup { public: MyPopup() { hWnd = CreateWindow(className, "My Popup", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 400, 300, NULL, NULL, hInstance, this); ShowWindow(hWnd, SW_SHOW); } void Show() { MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } } private: HWND hWnd; static const char* className; void OnPaint() { PAINTSTRUCT ps; HDC hdc = BeginPaint(hWnd, &ps); char buffer[256]; sprintf_s(buffer, "Page %d", page); TextOut(hdc, 20, 20, buffer, strlen(buffer)); EndPaint(hWnd, &ps); } void OnCommand(WPARAM wParam, LPARAM lParam) { switch (LOWORD(wParam)) { case IDOK: page++; InvalidateRect(hWnd, NULL, TRUE); break; case IDCANCEL: DestroyWindow(hWnd); break; } } static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { MyPopup* pPopup; if (message == WM_NCCREATE) { pPopup = static_cast<MyPopup*>(reinterpret_cast<CREATESTRUCT*>(lParam)->lpCreateParams); SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(pPopup)); pPopup->hWnd = hWnd; return DefWindowProc(hWnd, message, wParam, lParam); } else { pPopup = reinterpret_cast<MyPopup*>(GetWindowLongPtr(hWnd, GWLP_USERDATA)); } switch (message) { case WM_PAINT: pPopup->OnPaint(); break; case WM_COMMAND: pPopup->OnCommand(wParam, lParam); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; } }; const char* MyPopup::className = "MyPopupClass"; ``` 3. 在程序调用自定义的弹窗函数,创建自定义窗口并显示。 ``` void MyMessageBox() { MyPopup popup; popup.Show(); } ``` 4. 重载MessageBox函数,调用自定义的弹窗函数。 ``` int MyMessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType) { int ret = MessageBox(hWnd, lpText, lpCaption, uType | MB_USERICON); if (ret == IDOK) { MyMessageBox(); } return ret; } ``` 在上述代码,我们使用了Windows API来创建自定义窗口,并在其添加了一个按钮用于触发下一页的更新操作。在按钮被点击时,我们将page变量加1,并调用InvalidateRect函数来刷新窗口内容。然后,我们重载了MessageBox函数,并在其调用自定义的弹窗函数来显示自定义的弹窗。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值