rat-button

0.1.28 • Public • Published

rat-button

Button

Build Status tnpm status tnpm download line coverage branch coverage preact

  • category: Components
  • chinese: 按钮
  • type: 表单

按钮用于开始一个即时操作。

Guide

何时使用

标记了一个(或封装一组)操作命令,响应用户点击行为,触发相应的业务逻辑。

API

Button

参数 说明 类型 默认值
size 按钮的尺寸

可选值:
'small', 'medium', 'large'
Enum 'medium'
type 按钮的类型

可选值:
'primary', 'secondary', 'normal'
Enum 'normal'
htmlType 当 component = 'button' 时,设置 button 标签的 type 值

可选值:
'submit', 'reset', 'button'
Enum 'button'
component 设置标签类型

可选值:
'button', 'a'
Enum 'button'
loading 设置按钮的载入状态 Boolean false
text 是否为文本按钮 Boolean false
warning 是否为警告按钮 Boolean false
disabled 是否禁用 Boolean false
onClick 点击按钮的回调

签名:
Function(e: Object) => void
参数:
e: {Object} Event Object
Function () => {}

demo

import Button from 'rat-button';

class App extends React.Component {
    // ajax还要tools比较通用,所以从根组件使用context传入,避免props逐层传入
  constructor(props) {
    super(props);
  }
  render() {
    return (
      <div>
        <Button 
          style={{width: 150, height: 50}}
        >
          submit
        </Button>
      </div>
      )
    }
}

Readme

Keywords

Package Sidebar

Install

npm i rat-button

Weekly Downloads

3

Version

0.1.28

License

BSD-3-Clause

Unpacked Size

96.5 kB

Total Files

16

Last publish

Collaborators

  • 55555azhe
  • bondli