Skip to content

Commit 9c040ed

Browse files
committed
fix(Search): fixed disabled style error
1 parent 7e5f16e commit 9c040ed

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/search/__test__/__snapshots__/index.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ exports[`search Props :base 1`] = `
3131
<wx-input
3232
adjustPosition="{{true}}"
3333
alwaysEmbed="{{false}}"
34-
class="t-input__keyword t-class-input"
34+
class="t-input__keyword t-class-input "
3535
confirmHold="{{false}}"
3636
confirmType="search"
3737
cursor="{{0}}"

src/search/search.less

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
@search-padding: var(--td-search-padding, 16rpx 24rpx);
99
@search-placeholder-color: var(--td-search-placeholder-color, @text-color-placeholder);
1010
@search-icon-color: var(--td-search-icon-color, @text-color-placeholder);
11+
@search-disabled-text-color: var(--td-search-disabled-text-color, @text-color-disabled); // 输入框禁用态文本颜色
1112
@search-icon-font-size: var(--td-search-icon-font-size, 48rpx);
1213
@search-square-radius: var(--td-search-square-radius, @radius-default);
1314
@search-round-radius: calc(@search-height / 2);
@@ -62,6 +63,13 @@
6263
line-height: 48rpx;
6364
}
6465

66+
.@{prefix}-input--disabled {
67+
color: @search-disabled-text-color;
68+
cursor: not-allowed;
69+
opacity: 1;
70+
-webkit-text-fill-color: currentColor; // fix disabled color in iOS
71+
}
72+
6573
.@{prefix}-icon {
6674
color: @search-icon-color;
6775
font-size: @search-icon-font-size;

src/search/search.wxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
name="input"
2121
maxlength="{{maxlength}}"
2222
disabled="{{disabled || readonly}}"
23-
class="{{prefix}}-input__keyword {{prefix}}-class-input"
23+
class="{{prefix}}-input__keyword {{prefix}}-class-input {{ disabled ? prefix + '-input--disabled' : ''}}"
2424
focus="{{focus}}"
2525
value="{{value}}"
2626
confirm-type="{{confirmType}}"

0 commit comments

Comments
 (0)