1.0.11 • Published 2 years ago

@anchor-it/antd-modal v1.0.11

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

@anchor-it/antd-modal

anchor components library modal

Install

Use npm:

npm install --save @anchor-it/antd-modal

Use yarn:

yarn add @anchor-it/antd-modal -S

Usage

import React, { Component } from 'react';
import { Button } from 'antd';
import { ModalComponent } from '@anchor-it/antd-modal';

export default class App extends Component {
  handleButtonOnClick = () => {
    this.myModal.openModal();
  };

  handleModalOnClosed = () => {
    console.log('modal closed');
  };

  handleModalOnOk = () => {
    return new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve({ message: '' });
      }, 2000);
    });
  };

  render() {
    return (
      <div style={{ padding: 16 }}>
        <Button type={'primary'} onClick={this.handleButtonOnClick}>
          弹窗
        </Button>

        <ModalComponent
          ref={(node) => (this.myModal = node)}
          title={'弹窗标题'}
          hasMask={true}
          width={'760px'}
          height={'380px'}
          okText={'确定'}
          cancelText={'关闭'}
          onClose={this.handleModalOnClosed}
          onCancel={this.handleModalOnClosed}
          onClosed={this.handleModalOnClosed}
          onOk={this.handleModalOnOk}
        >
          <div>我是弹窗内容</div>
          <div>我是弹窗内容</div>
        </ModalComponent>
      </div>
    );
  }
}

Api

属性说明类型默认值
title弹窗标题string
width弹窗宽度string400
height弹窗高度string320
hasMask是否显示遮罩层booleantrue
maskClosable点击蒙层是否允许关闭booleanfalse
okText确定按钮显示的文字string确定
cancelText取消按钮显示的文字string取消
draggable是否允许拖拽booleantrue
footer弹窗底部区域,如果不需要显示底部区域,可以将 footer 设为null或者falseany
footerActions底部需要显示的按钮组string[]cancel, ok
okButtonLoading确定按钮的 loading 状态boolean
onClose弹窗关闭事件function
onClosed弹窗关闭后触发的事件function
onOk弹窗按下“确认”按钮后的事件function
bodyStyle弹窗 body 的 style 参数object
destroyOnClose弹窗是否在关闭时移除booleantrue

License

MIT

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago