Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[new feature] Button: add info type #1340

Merged
merged 1 commit into from
Feb 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions example/pages/button/index.wxml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<demo-section>
<demo-block title="按钮类型" padding>
<view class="row">
<van-button class="demo-margin-right">默认按钮</van-button>
<van-button type="primary" class="demo-margin-right">主要按钮</van-button>
<van-button type="danger">危险按钮</van-button>
<van-button type="info" class="demo-margin-right">信息按钮</van-button>
</view>
<van-button class="demo-margin-right">默认按钮</van-button>
<van-button type="danger" class="demo-margin-right">危险按钮</van-button>
<van-button type="warning">警告按钮</van-button>
</demo-block>

Expand Down
6 changes: 4 additions & 2 deletions packages/button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
### 代码演示

#### 按钮类型
支持`default`、`primary`、`warning`、`danger`四种类型,默认为`default`

支持`default`、`primary`、`info`、`warning`、`danger`五种类型,默认为`default`

```html
<van-button type="default">默认按钮</van-button>
<van-button type="primary">主要按钮</van-button>
<van-button type="info">信息按钮</van-button>
<van-button type="warning">警告按钮</van-button>
<van-button type="danger">危险按钮</van-button>
```
Expand Down Expand Up @@ -65,7 +67,7 @@
| 参数 | 说明 | 类型 | 默认值 |
|-----------|-----------|-----------|-------------|
| id | 标识符 | `String` | - |
| type | 按钮类型,可选值为 `primary` `warning` `danger` | `String` | `default` |
| type | 按钮类型,可选值为 `primary` `info` `warning` `danger` | `String` | `default` |
| size | 按钮尺寸,可选值为 `normal` `large` `small` `mini` | `String` | `normal` |
| plain | 是否为朴素按钮 | `Boolean` | `false` |
| disabled | 是否禁用按钮 | `Boolean` | `false` |
Expand Down
10 changes: 10 additions & 0 deletions packages/button/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
border: 1px solid @button-primary-border-color;
}

&--info {
color: @button-info-color;
background-color: @button-info-background-color;
border: 1px solid @button-info-border-color;
}

&--danger {
color: @button-danger-color;
background-color: @button-danger-background-color;
Expand All @@ -68,6 +74,10 @@
color: @button-primary-background-color;
}

&.van-button--info {
color: @button-info-background-color;
}

&.van-button--danger {
color: @button-danger-background-color;
}
Expand Down
3 changes: 3 additions & 0 deletions packages/common/style/var.less
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
@button-primary-color: @white;
@button-primary-background-color: @green;
@button-primary-border-color: @green;
@button-info-color: @white;
@button-info-background-color: @blue;
@button-info-border-color: @blue;
@button-danger-color: @white;
@button-danger-background-color: @red;
@button-danger-border-color: @red;
Expand Down