drip-ui
Version:
Lightweight Mobile UI Components built on Vue
85 lines (64 loc) • 2.47 kB
Markdown
## Button 按钮
### 使用指南
``` javascript
import { Button } from 'drip-ui';
Vue.use(Button);
```
### 代码演示
#### 常规
支持`default`、`blue`、`orange`、`green`四种类型,默认为`default`
```html
<drip-button type="blue">蓝色</drip-button>
<drip-button type="orange">橘色按钮</drip-button>
<drip-button type="green">绿色按钮</drip-button>
<drip-button type="default">默认按钮</drip-button>
```
#### 简约
```html
<drip-button plain type="blue">蓝色</drip-button>
<drip-button plain type="orange">橘色按钮</drip-button>
<drip-button plain type="green">绿色按钮</drip-button>
```
#### 禁用
通过`disabled`属性来禁用按钮,此时按钮不可点击
```html
<drip-button disabled type="blue">蓝色</drip-button>
<drip-button disabled type="orange">橘色按钮</drip-button>
<drip-button disabled type="green">绿色按钮</drip-button>
```
#### 加载状态
```html
<drip-button loading type="blue">蓝色</drip-button>
<drip-button loading type="orange">橘色按钮</drip-button>
<drip-button loading type="green">绿色按钮</drip-button>
```
#### 按钮形状
```html
<drip-button square type="default">默认按钮</drip-button>
<drip-button round type="blue">蓝色</drip-button>
```
#### 按钮尺寸
支持`large`、`normal`、`small`三种尺寸,默认为`normal`
```html
<drip-button size="large" type="green">大按钮</drip-button>
<drip-button size="normal" type="blue">正常按钮</drip-button>
<drip-button size="small">小按钮</drip-button>
```
### API
| 参数 | 说明 | 类型 | 默认值 |
|-----------|-----------|-----------|-------------|
| type | 按钮类型,可选值为 `default` `blue` `orange` `green` | `String` | `default` |
| size | 按钮尺寸,可选值为 `normal` `large` `small` | `String` | `normal` |
| text | 按钮文字 | `String` | - |
| tag | 按钮 HTML 标签 | `String` | `button` |
| native-type | 按钮类型(原生) | `String` | - |
| plain | 是否为朴素按钮 | `Boolean` | `false` |
| disabled | 是否禁用按钮 | `Boolean` | `false` |
| loading | 是否显示为加载状态 | `Boolean` | `false` |
| block | 是否为块级元素 | `Boolean` | `false` |
| round | 是否为圆形按钮 | `Boolean` | `false` |
| square | 是否为方形按钮 | `Boolean` | `false` |
### Event
| 事件名 | 说明 | 参数 |
|-----------|-----------|-----------|
| click | 点击按钮且按钮状态不为加载或禁用时触发 | - |