mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-05 19:41:45 +08:00
[new feature] Button: add loading-text prop (#1300)
This commit is contained in:
parent
cbdccdf820
commit
59efba991b
@ -19,8 +19,8 @@
|
||||
</demo-block>
|
||||
|
||||
<demo-block title="加载状态" padding>
|
||||
<van-button loading type="primary" class="demo-margin-right" loading-class="loading" />
|
||||
<van-button loading type="danger" loading-class="loading" />
|
||||
<van-button loading type="primary" class="demo-margin-right" />
|
||||
<van-button loading type="danger" loading-text="加载中..." />
|
||||
</demo-block>
|
||||
|
||||
<demo-block title="按钮形状" padding>
|
||||
|
@ -1,7 +1,3 @@
|
||||
.loading {
|
||||
margin: 0 18px;
|
||||
}
|
||||
|
||||
.row {
|
||||
height: 44px;
|
||||
margin-bottom: 15px;
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
```html
|
||||
<van-button loading type="primary" />
|
||||
<van-button loading type="danger" />
|
||||
<van-button loading type="danger" loading-text="加载中..." />
|
||||
```
|
||||
|
||||
#### 按钮形状
|
||||
|
@ -125,4 +125,10 @@
|
||||
&--disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
&__loading-text {
|
||||
margin-left: 5px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ VantComponent({
|
||||
square: Boolean,
|
||||
loading: Boolean,
|
||||
disabled: Boolean,
|
||||
loadingText: String,
|
||||
type: {
|
||||
type: String,
|
||||
value: 'default'
|
||||
|
@ -23,11 +23,18 @@
|
||||
bindlaunchapp="bindLaunchApp"
|
||||
bindopensetting="bindOpenSetting"
|
||||
>
|
||||
<van-loading
|
||||
wx:if="{{ loading }}"
|
||||
custom-class="loading-class"
|
||||
size="{{ size === 'mini' ? '14px' : '20px' }}"
|
||||
color="{{ type === 'default' ? '#c9c9c9' : '' }}"
|
||||
/>
|
||||
<block wx:if="{{ loading }}">
|
||||
<van-loading
|
||||
custom-class="loading-class"
|
||||
size="{{ size === 'mini' ? '14px' : '20px' }}"
|
||||
color="{{ type === 'default' ? '#c9c9c9' : '' }}"
|
||||
/>
|
||||
<view
|
||||
wx:if="{{ loadingText }}"
|
||||
class="van-button__loading-text"
|
||||
>
|
||||
{{ loadingText }}
|
||||
</view>
|
||||
</block>
|
||||
<slot wx:else />
|
||||
</button>
|
||||
|
Loading…
x
Reference in New Issue
Block a user