[new feature] Button: add loading-text prop (#1300)

This commit is contained in:
neverland 2019-02-13 17:53:54 +08:00 committed by GitHub
parent cbdccdf820
commit 59efba991b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 13 deletions

View File

@ -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>

View File

@ -1,7 +1,3 @@
.loading {
margin: 0 18px;
}
.row {
height: 44px;
margin-bottom: 15px;

View File

@ -40,7 +40,7 @@
```html
<van-button loading type="primary" />
<van-button loading type="danger" />
<van-button loading type="danger" loading-text="加载中..." />
```
#### 按钮形状

View File

@ -125,4 +125,10 @@
&--disabled {
opacity: 0.5;
}
&__loading-text {
margin-left: 5px;
display: inline-block;
vertical-align: middle;
}
}

View File

@ -14,6 +14,7 @@ VantComponent({
square: Boolean,
loading: Boolean,
disabled: Boolean,
loadingText: String,
type: {
type: String,
value: 'default'

View File

@ -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>