wupengfei
2025-11-07 e848523308be4662afb631e6117d642e0fbb445a
packages/utils/message.tsx
@@ -25,13 +25,22 @@
  title?: string;
  message?: string | VNode;
  confirmText?: string;
  cancelText?: string;
  showCancelBtn?: boolean;
};
export class Message {
  static confirm(options: ConfirmOptions = {}) {
    const { title = '提示', message = '确定要删除该数据吗?', confirmText = '确认' } = options;
    const {
      title = '提示',
      message = '确定要删除该数据吗?',
      confirmText = '确认',
      cancelText = '取消',
      showCancelBtn = true,
    } = options;
    return new Promise((resolve, reject) => {
      Portal.add((key) => {
        console.log('key: ', key);
        return (
          //@ts-ignore
          <Portal.Container keyNumber={key} delayOpen>
@@ -42,6 +51,8 @@
                  title={title}
                  visible={open.value}
                  content={message}
                  showCancelBtn={showCancelBtn}
                  cancelText={cancelText}
                  onCancel={() => {
                    onClose();
                    reject();
@@ -51,6 +62,11 @@
                    resolve(1);
                  }}
                  confirmText={confirmText}
                  //@ts-ignore
                  onClickOverlay={() => {
                    onClose();
                    reject();
                  }}
                ></Model>
              ),
            }}