mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
[Improvement] Button: add square prop (#427)
This commit is contained in:
parent
b3d2be2e63
commit
ccb1d06437
@ -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 |
|
||||
|
@ -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
|
||||
|
@ -124,6 +124,10 @@
|
||||
display: block;
|
||||
}
|
||||
|
||||
&--square {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
&--disabled {
|
||||
color: $button-disabled-color;
|
||||
background-color: $button-disabled-background-color;
|
||||
|
Loading…
x
Reference in New Issue
Block a user