[Improvement] Button: add square prop (#427)

This commit is contained in:
neverland 2018-08-14 20:42:57 +08:00 committed by GitHub
parent b3d2be2e63
commit ccb1d06437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -63,6 +63,7 @@
| disabled | 是否禁用 | `Boolean` | `false` |
| loading | 是否显示为加载状态 | `Boolean` | `false` |
| block | 是否为块级元素 | `Boolean` | `false` |
| square | 是否为方形按钮 | `Boolean` | `false` |
| open-type | 微信开放能力 | `String` | - |
| app-parameter | 打开 APP 时,向 APP 传递的参数 | `String` | - |
| hover-start-time | 按住后多久出现点击态,单位毫秒 | `Number` | 20 |

View File

@ -36,6 +36,10 @@ Component({
block: {
type: Boolean,
observer
},
square: {
type: Boolean,
observer
}
},
@ -51,11 +55,12 @@ Component({
},
setClasses() {
const { type, size, plain, disabled, loading, block } = this.data;
const { type, size, plain, disabled, loading, square, block } = this.data;
this.setData({
classes: classnames(`van-button--${type}`, `van-button--${size}`, {
'van-button--block': block,
'van-button--plain': plain,
'van-button--square': square,
'van-button--loading': loading,
'van-button--disabled': disabled,
'van-button--unclickable': disabled || loading

View File

@ -124,6 +124,10 @@
display: block;
}
&--square {
border-radius: 0;
}
&--disabled {
color: $button-disabled-color;
background-color: $button-disabled-background-color;