0.1.1 • Published 4 years ago

xy-model v0.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago
IEChromeFirefoxOperaSafari
IE 10+ ✔Chrome 31.0+ ✔Firefox 31.0+ ✔Opera 30.0+ ✔Safari 7.0+ ✔

NPM version node version npm download

xy-model

xy-model

模态对话框组件,有标题和页脚按钮。

安装

# yarn
yarn add xy-model

使用例子

ModelFooter将没有 onClick 事件的元素默认带上关闭对话框事件

import React from "react";
import ReactDOM from "react-dom";
import { Model, ModelBody, ModelFooter } from "xy-model";
ReactDOM.render(
    <Model title="对话框标题" maskClose={false} visible={visible} onChange={setVisible}>
        <ModelBody>
            <p>这是对话框内容</p>
            <p>这是对话框内容</p>
            <p>这是对话框内容</p>
            <p>这是对话框内容</p>
        </ModelBody>
        <ModelFooter>
            <Button type="text">取消</Button>
            <Button type="primary">确定</Button>
        </ModelFooter>
    </Model>,
    container,
);

API

属性说明类型默认值
title对话框标题React.ReactNode
visible是否显示booleanfalse
defaultVisible否默认显示booleanfalse
initialFocus对话框打开焦点元素选择器boolean
getContainer返回一个容器来装载抽屉HTMLElement/() => HTMLElement
children对话框内容React.ReactNode
fixed是否固定booleantrue
showMask是否显示蒙层booleantrue
maskClose蒙层是否可关闭对话框booleantrue
closeOnPressEsc是否 ESC 关闭booleantrue
onChange对话框可视改变事件(visible: boolean) => void
onKeyDown键盘按下事件(event: React.KeyboardEvent) => void
onUnmount对话框关闭动画结束Function
onClose关闭事件Function
getCloseFunc获取关闭函数(close: Function) => void

开发

yarn run start

例子

http://localhost:6006

测试

yarn run test

开源许可

xy-model is released under the MIT license.

0.1.1

4 years ago

0.1.0

4 years ago

0.0.52

5 years ago

0.0.51

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago