Button 按钮
常用的操作按钮。
基础用法
基础按钮
支持六种语义类型。
vue
<sky-button>默认</sky-button>
<sky-button type="primary">主要</sky-button>
<sky-button type="success">成功</sky-button>
<sky-button type="warning">警告</sky-button>
<sky-button type="danger">危险</sky-button>
<sky-button type="info">信息</sky-button>朴素 / 圆角 / 圆形
形态
plain、shape='round'、shape='circle'。
vue
<sky-button type="primary" plain>朴素</sky-button>
<sky-button type="primary" shape="round">圆角</sky-button>
<sky-button type="primary" shape="circle" icon="check" />尺寸
尺寸
small / medium / large。
vue
<sky-button size="small" type="primary">小</sky-button>
<sky-button type="primary">中(默认)</sky-button>
<sky-button size="large" type="primary">大</sky-button>加载与禁用
加载与禁用
vue
<sky-button type="primary" loading>加载中</sky-button>
<sky-button type="primary" disabled>已禁用</sky-button>块级按钮
block 充满父容器
vue
<sky-button type="primary" block>提交</sky-button>API
Props
| 属性 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| type | 按钮语义类型 | 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'default' |
| size | 按钮尺寸 | 'small' | 'medium' | 'large' | 'medium' |
| shape | 形状 | 'square' | 'round' | 'circle' | 'square' |
| plain | 是否朴素 | boolean | false |
| disabled | 是否禁用 | boolean | false |
| loading | 加载状态 | boolean | false |
| block | 是否块级(占满父容器) | boolean | false |
| icon | 前置图标 name | string | — |
| native-type | H5 下原生 button type | 'button' | 'submit' | 'reset' | 'button' |
| open-type | 微信小程序 open-type 透传 | string | — |
Events
| 事件 | 说明 | 回调参数 |
|---|---|---|
| click | 点击触发(disabled / loading 时不触发) | (e: Event) => void |
Slots
| 名称 | 说明 |
|---|---|
| default | 按钮文字 |