Skip to content

Commit 10ebf5c

Browse files
fix: 🐛 修复Button设置为hairline时圆角显示异常的问题
Closes: #486
1 parent f9ca2e4 commit 10ebf5c

File tree

2 files changed

+36
-18
lines changed

2 files changed

+36
-18
lines changed

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

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
background: transparent;
5252
box-sizing: border-box;
5353
border: none;
54+
border-radius: 0;
5455
color: $-button-normal-color;
5556
transition: opacity 0.2s;
5657
user-select: none;
@@ -75,6 +76,7 @@
7576

7677
&::after {
7778
border: none;
79+
border-radius: 0;
7880
}
7981

8082
@include m(active) {
@@ -224,7 +226,6 @@
224226

225227
@include when(round) {
226228
border-radius: 999px;
227-
overflow: hidden;
228229
}
229230

230231
@include when(text) {
@@ -253,46 +254,69 @@
253254

254255
@include when(plain) {
255256
background: $-button-plain-bg-color;
257+
border: 1px solid currentColor;
256258

257259
@include when(primary) {
258260
color: $-button-primary-bg-color;
259-
border: 1px solid $-button-primary-bg-color;
260261
}
261262

262263
@include when(success) {
263264
color: $-button-success-bg-color;
264-
border: 1px solid $-button-success-bg-color;
265265
}
266266

267267
@include when(info) {
268268
color: $-button-info-plain-normal-color;
269-
border: 1px solid $-button-info-plain-border-color;
269+
border-color: $-button-info-plain-border-color;
270270
}
271271

272272
@include when(warning) {
273273
color: $-button-warning-bg-color;
274-
border: 1px solid $-button-warning-bg-color;
275274
}
276275

277276
@include when(error) {
278277
color: $-button-error-bg-color;
279-
border: 1px solid $-button-error-bg-color;
280278
}
281279
}
282280

283281
@include when(hairline) {
282+
border-width: 0;
283+
284284
&.is-plain {
285-
border-width: 0;
286-
border-radius: 0;
287285
@include halfPixelBorderSurround();
288286

287+
&::before {
288+
border-radius: inherit;
289+
}
290+
289291
&::after {
290292
border-color: inherit;
291293
}
292-
}
293294

294-
}
295+
&.is-round {
296+
&::after {
297+
border-radius: inherit !important;
298+
}
299+
}
295300

301+
&.is-large {
302+
&::after {
303+
border-radius: calc(2 * $-button-large-radius);
304+
}
305+
}
306+
307+
&.is-medium {
308+
&::after {
309+
border-radius: calc(2 * $-button-medium-radius);
310+
}
311+
}
312+
313+
&.is-small {
314+
&::after {
315+
border-radius: calc(2 * $-button-small-radius);
316+
}
317+
}
318+
}
319+
}
296320

297321
@include when(block) {
298322
display: flex;
@@ -332,12 +356,6 @@
332356
}
333357
}
334358

335-
// 微信2.8.0以上版本加了较高层级的默认样式,需要重置掉
336-
.wd-button {
337-
min-height: auto;
338-
width: auto;
339-
}
340-
341359
@keyframes wd-rotate {
342360
from {
343361
transform: rotate(0deg);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
'wd-button',
88
'is-' + type,
99
'is-' + size,
10-
plain ? 'is-plain' : '',
11-
disabled ? 'is-disabled' : '',
1210
round ? 'is-round' : '',
1311
hairline ? 'is-hairline' : '',
12+
plain ? 'is-plain' : '',
13+
disabled ? 'is-disabled' : '',
1414
block ? 'is-block' : '',
1515
loading ? 'is-loading' : '',
1616
customClass

0 commit comments

Comments
 (0)