@cloudbase/weda-ui-mp 3.18.6 → 3.18.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -35,7 +35,7 @@ Component({
|
|
|
35
35
|
placeholderCls: `${WD_PREFIX}-form-input-wrap__placeholder weui-input__placeholder`,
|
|
36
36
|
cls: '',
|
|
37
37
|
currentInputValue: '',
|
|
38
|
-
|
|
38
|
+
_hasClearIcon: false,
|
|
39
39
|
isFocus: false,
|
|
40
40
|
counter: 0,
|
|
41
41
|
|
|
@@ -102,9 +102,9 @@ Component({
|
|
|
102
102
|
},
|
|
103
103
|
observers: {
|
|
104
104
|
'disabled,clearable,isFocus,currentInputValue': function (disabled, clearable, isFocus, currentInputValue) {
|
|
105
|
-
const
|
|
105
|
+
const _hasClearIcon = clearable && isFocus && !disabled && currentInputValue?.length > 0;
|
|
106
106
|
const counter = typeof currentInputValue === 'string' ? currentInputValue.length : 0;
|
|
107
|
-
this.setData({
|
|
107
|
+
this.setData({ _hasClearIcon, counter });
|
|
108
108
|
},
|
|
109
109
|
'disabled,size,classRoot,wrapClassName,before,after': function (
|
|
110
110
|
disabled,
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
</view>
|
|
57
57
|
|
|
58
58
|
<!-- 清除按钮 -->
|
|
59
|
-
<block wx:if="{{
|
|
60
|
-
<view class="{{inputWrap}}__after">
|
|
59
|
+
<block wx:if="{{_hasClearIcon}}">
|
|
60
|
+
<view class="{{inputWrap}}__after" >
|
|
61
61
|
<wd-icon className="{{classPrefix}}-icon__trigger" name="td:close-circle-filled" size="{{iconSize}}" bind:touchstart="handleClear"></wd-icon>
|
|
62
62
|
</view>
|
|
63
63
|
</block>
|
|
64
64
|
|
|
65
65
|
<!-- 后缀图标 -->
|
|
66
|
-
<block wx:if="{{!
|
|
66
|
+
<block wx:if="{{!_hasClearIcon && suffixType}}">
|
|
67
67
|
<view class="{{inputWrap}}__after" data-type="suffix" bind:tap="inputAdornmentClick">
|
|
68
68
|
<wd-icon name="{{suffixIcon}}" type="{{suffixType}}" src="{{suffixSrc}}" size="{{iconSize}}" className="{{root}}__icon-after"></wd-icon>
|
|
69
69
|
</view>
|