Skip to content

Commit 3ba8a67

Browse files
committed
fix: fixed basicButton ghost style
修正BasicButton幽灵状态的样式
1 parent beb4ae9 commit 3ba8a67

File tree

3 files changed

+44
-42
lines changed

3 files changed

+44
-42
lines changed

src/design/ant/btn.less

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,26 @@
2020
border-color: transparent !important;
2121
}
2222

23-
//&-primary {
24-
// color: @white;
25-
// background-color: @button-primary-color;
26-
// border-width: 0;
27-
//
28-
// &:hover,
29-
// &:focus {
30-
// color: @white !important;
31-
// background-color: @button-primary-hover-color;
32-
// }
33-
//
34-
// &[disabled],
35-
// &[disabled]:hover {
36-
// color: @white;
37-
// background-color: fade(@button-primary-color, 40%);
38-
// }
39-
//}
23+
&-primary {
24+
color: @white;
25+
background-color: @button-primary-color;
26+
27+
&:hover,
28+
&:focus {
29+
color: @white;
30+
background-color: @button-primary-hover-color;
31+
}
32+
33+
&[disabled],
34+
&[disabled]:hover {
35+
color: fade(@button-cancel-color, 40%);
36+
background-color: fade(@button-cancel-bg-color, 40%);
37+
}
38+
}
39+
40+
&-primary:not(&-background-ghost) {
41+
border-width: 0;
42+
}
4043

4144
&-default {
4245
color: @button-cancel-color;
@@ -50,12 +53,12 @@
5053
border-color: @button-cancel-hover-border-color;
5154
}
5255

53-
//&[disabled],
54-
//&[disabled]:hover {
55-
// color: fade(@button-cancel-color, 40%);
56-
// background: fade(@button-cancel-bg-color, 40%);
57-
// border-color: fade(@button-cancel-border-color, 40%);
58-
//}
56+
&[disabled],
57+
&[disabled]:hover {
58+
color: fade(@button-cancel-color, 40%);
59+
background: fade(@button-cancel-bg-color, 40%);
60+
border-color: fade(@button-cancel-border-color, 40%);
61+
}
5962
}
6063

6164
[data-theme='light'] &.ant-btn-link.is-disabled {
@@ -212,33 +215,31 @@
212215
}
213216
}
214217

215-
&-background-ghost.ant-btn-link,
216-
&.ant-btn-dashed:not([disabled='disabled']) {
217-
// color: @text-color-call-out;
218-
219-
&:hover {
220-
color: @button-primary-color;
221-
}
218+
&-background-ghost {
219+
border-width: 1px;
222220
}
223221

224-
&-background-ghost {
222+
&-dashed&-background-ghost,
223+
&-default&-background-ghost {
225224
color: @button-ghost-color;
226225
background-color: transparent;
227226
border-color: @button-ghost-color;
228-
border-width: 1px;
229227

230228
&:hover,
231229
&:focus {
232-
color: @button-ghost-hover-color !important;
233-
background-color: @button-ghost-hover-bg-color;
230+
color: @button-ghost-hover-color;
234231
border-color: @button-ghost-hover-color;
235232
}
236233

234+
&:active {
235+
color: @button-ghost-active-color;
236+
border-color: @button-ghost-active-color;
237+
}
238+
237239
&[disabled],
238240
&[disabled]:hover {
239-
color: fade(@white, 40%) !important;
240-
background-color: fade(@white, 40%);
241-
border-color: fade(@white, 40%) !important;
241+
color: fade(@white, 40%);
242+
border-color: fade(@white, 40%);
242243
}
243244
}
244245

src/design/color.less

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,10 @@ html {
111111
@button-primary-hover-color: lighten(@primary-color, 5%);
112112
@button-primary-active-color: darken(@primary-color, 5%);
113113

114-
@button-ghost-color: @primary-color;
115-
@button-ghost-hover-color: lighten(@primary-color, 10%);
114+
@button-ghost-color: @white;
115+
@button-ghost-hover-color: lighten(@white, 10%);
116116
@button-ghost-hover-bg-color: #e1ebf6;
117+
@button-ghost-active-color: darken(@white, 10%);
117118

118119
@button-success-color: @success-color;
119120
@button-success-hover-color: lighten(@success-color, 10%);

src/views/demo/comp/button/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@
4343
<a-button ghost color="success" class="ml-2"> 幽灵成功 </a-button>
4444
<a-button ghost color="warn" class="ml-2"> 幽灵警告 </a-button>
4545
<a-button ghost color="error" class="ml-2"> 幽灵错误 </a-button>
46-
47-
<a-button ghost type="dashed" color="warn" class="ml-2"> 幽灵warn-dashed </a-button>
46+
<a-button ghost type="dashed" color="warn" class="ml-2"> 幽灵警告dashed </a-button>
47+
<a-button ghost type="danger" class="ml-2"> 幽灵危险 </a-button>
4848
<div class="bg-gray-400 p-2 m-2">
4949
<h3 class="text-white">常规幽灵按钮通常用于有色背景下</h3>
5050
<a-button ghost type="primary" class="ml-2"> 幽灵主要 </a-button>
5151
<a-button ghost type="dashed" class="ml-2"> 幽灵dashed </a-button>
5252
<a-button ghost type="primary" class="ml-2" disabled> 禁用 </a-button>
5353
<a-button ghost type="primary" class="ml-2" loading> loading </a-button>
5454
<a-button ghost type="default" class="ml-2"> 幽灵默认 </a-button>
55-
<a-button ghost type="danger" class="ml-2"> 幽灵危险 </a-button>
5655
</div>
56+
<!-- antd 按钮不能同时使用ghost和link -->
5757
<!-- <a-button ghost type="link" class="ml-2"> link </a-button>-->
5858
<!-- <a-button ghost type="link" class="ml-2" loading> loading link </a-button>-->
5959
<!-- <a-button ghost type="link" class="ml-2" disabled> disabled link </a-button>-->

0 commit comments

Comments
 (0)