0.1.12 • Published 5 years ago

@mistong/eui-dialog v0.1.12

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

eui-dialog

eui dialog component 弹窗组件

Usage

import React from 'react';
import ReactDOM from 'react-dom';
import Dialog from 'eui-dialog';

ReactDOM.render(
    <Dialog
        title="这是对话框的标题"
        visible={this.state.visible}
        onOk={() => this.handleOk()}
        onCancel={() =>this.handleCancel()}
    >
        <p>这是对话框的内容</p>
    </Dialog>,
    document.getElementById('app')
);

API

参数类型默认值说明
titleString | ReactElement标题
classNameString容器类名
prefixClsString"eui-dialog"自定义类名前缀
visibleBooleanfalse对话框是否可见
widthString | Number"580px"宽度
localeStringzh-cn国际化(zh-cn, en-us)
maskClosableBooleantrue点击蒙层是否允许关闭
onOkFunction() => {}点击确定回调,参数为关闭函数,返回 promise 时 resolve 后自动关闭
onCancelFunction() => {}点击取消回调,参数为关闭函数,返回 promise 时 resolve 后自动关闭

剩余API可以参照 rc-dialog api

Dialog.method()

包含:

  • Dialog.confirm
  • Dialog.success
  • Dialog.warning
  • Dialog.error
  • Dialog.info
// usage example

Dialog.confirm({
  title: '这是一个confirm的title',
  content: '这是一个confirm的content',
})

以上均为一个函数,参数为 object,具体属性如下:

参数类型默认值说明
titleString | ReactElement标题
contentString | ReactElement内容
classNameString容器类名
widthString | Number"390px"宽度
localeStringzh-cn国际化(zh-cn, en-us)
okTextString确定确认按钮文字
cancelTextString取消取消按钮文字
maskClosableBooleanfalse点击蒙层是否允许关闭
onOkFunction() => {}点击确定回调,参数为关闭函数,返回 promise 时 resolve 后自动关闭
onCancelFunction() => {}点击取消回调,参数为关闭函数,返回 promise 时 resolve 后自动关闭

以上函数调用后,会返回一个引用,可以通过该引用关闭弹窗。

const ref = Dialog.info();
ref.close();

开发规约

  • fork项目到自己仓库
  • npm i
  • 编辑器开启eslint
  • 提交代码信息使用git-cz
0.1.12

5 years ago

0.1.11

5 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago