1 | import React, {
|
2 | Component,
|
3 | PropTypes
|
4 | } from 'react'
|
5 | import {
|
6 | render
|
7 | } from 'react-dom'
|
8 |
|
9 | import BaseButton from "../lib/index"
|
10 |
|
11 | class App extends Component {
|
12 | constructor() {
|
13 | super();
|
14 | this.state = {
|
15 | BaseData: {
|
16 | "bsStyle": "weaken"
|
17 | /**按钮类型(string)。参数:
|
18 | 1.默认:“default”
|
19 | 2.弱化按钮:“weaken”
|
20 | 3.连接按钮:“link”
|
21 | **/
|
22 | ,
|
23 | "bsSize": "small"
|
24 | /**按钮尺寸(string)。参数:
|
25 | 1.默认:“default”
|
26 | 2.小按钮:“small”
|
27 | 3.块状按钮:“block”
|
28 | **/
|
29 | ,
|
30 | "active": false
|
31 | /**是否选中(Boolean)。参数:
|
32 | 1.默认未选中:false
|
33 | 2.选中:true
|
34 | **/
|
35 | ,
|
36 | "disabled": false
|
37 | /**是否禁用(Boolean)。参数:
|
38 | 1.默认不禁用:false
|
39 | 2.禁用:true
|
40 | **/
|
41 | ,
|
42 | "href": "" /**如果该字段有定义且非空,return(<a/>),否则return(</button>)**/ ,
|
43 | "hidden": false //是否显示按钮
|
44 | ,
|
45 | "title": "测试测试测试" /**显示文本(string)**/ ,
|
46 | "maxWidth": "" //最大宽度,默认为"" ,超出后,超出的部分显示...
|
47 | ,
|
48 | "onClick": function(target,onClick,btnInfo) {
|
49 | console.log(target); //输出e
|
50 | console.log(onClick); //输出true
|
51 | console.log(btnInfo); //输出this.state
|
52 | } /**点击后事件回调**/
|
53 | }
|
54 | }
|
55 | }
|
56 |
|
57 | render() {
|
58 | return (
|
59 | <BaseButton {...this.state.BaseData} />
|
60 | )
|
61 | }
|
62 | }
|
63 | module.exports = App; |
\ | No newline at end of file |