Skip to content

Commit ea8bc66

Browse files
fix: 🐛 修复 Button 按钮设置为 block 无效的问题 (#762)
1 parent 356cb4a commit ea8bc66

2 files changed

Lines changed: 17 additions & 9 deletions

File tree

src/uni_modules/wot-design-uni/components/wd-button/index.scss

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@
4242

4343
@include b(button) {
4444
position: relative;
45-
display: inline-flex;
46-
justify-content: center;
47-
align-items: center;
45+
display: inline-block;
4846
outline: none;
4947
-webkit-appearance: none;
5048
outline: none;
@@ -79,6 +77,13 @@
7977
border-radius: 0;
8078
}
8179

80+
@include e(content) {
81+
display: flex;
82+
justify-content: center;
83+
align-items: center;
84+
height: 100%;
85+
}
86+
8287
@include m(active) {
8388
&:active::before {
8489
opacity: 0.15;
@@ -147,9 +152,10 @@
147152
padding: $-button-medium-padding;
148153
border-radius: $-button-medium-radius;
149154
font-size: $-button-medium-fs;
155+
min-width: 120px;
156+
150157

151158
@include when(round) {
152-
min-width: 120px;
153159

154160
@include when(icon) {
155161
min-width: 0;
@@ -280,7 +286,7 @@
280286
}
281287

282288
@include when(block) {
283-
display: flex;
289+
display: block;
284290
}
285291

286292
@include when(icon) {

src/uni_modules/wot-design-uni/components/wd-button/wd-button.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@
3838
@chooseavatar="handleChooseavatar"
3939
@agreeprivacyauthorization="handleAgreePrivacyAuthorization"
4040
>
41-
<view v-if="loading" class="wd-button__loading">
42-
<view class="wd-button__loading-svg" :style="loadingStyle"></view>
41+
<view class="wd-button__content">
42+
<view v-if="loading" class="wd-button__loading">
43+
<view class="wd-button__loading-svg" :style="loadingStyle"></view>
44+
</view>
45+
<wd-icon v-else-if="icon" custom-class="wd-button__icon" :name="icon" :classPrefix="classPrefix"></wd-icon>
46+
<view class="wd-button__text"><slot /></view>
4347
</view>
44-
<wd-icon v-else-if="icon" custom-class="wd-button__icon" :name="icon" :classPrefix="classPrefix"></wd-icon>
45-
<view class="wd-button__text"><slot /></view>
4648
</button>
4749
</template>
4850

0 commit comments

Comments
 (0)