[add] input右边图标点击事件回传,可以设置防抖节流功能。

This commit is contained in:
zhengliming
2024-03-20 20:33:07 +08:00
parent 59ad09b521
commit 42f04770c4
+14 -1
View File
@@ -81,7 +81,7 @@
v-else-if="type === 'text' && !focused && showRightIcon && rightIcon !== ''" v-else-if="type === 'text' && !focused && showRightIcon && rightIcon !== ''"
class="tn-input__right-icon__item tn-input__right-icon__clear" class="tn-input__right-icon__item tn-input__right-icon__clear"
> >
<view class="icon" :class="[`tn-icon-${rightIcon}`]"></view> <tn-button shape="icon" :scene="scene" :block-time="blockTime" @click="rightIconClick"><view class="icon" :class="[`tn-icon-${rightIcon}`]"></view></tn-button>
</view> </view>
<!-- 显示密码按钮 --> <!-- 显示密码按钮 -->
<view <view
@@ -239,6 +239,16 @@
rightIcon: { rightIcon: {
type: String, type: String,
default: '' default: ''
},
//场景:debounce :防抖模式 throttle:节流模式
scene:{
type: String,
default: 'debounce'
},
// 防抖节流间隔时间(毫秒)
blockTime:{
type: Number,
default: 500
} }
}, },
computed: { computed: {
@@ -299,6 +309,9 @@
this.$on("on-form-item-error", this.onFormItemError) this.$on("on-form-item-error", this.onFormItemError)
}, },
methods: { methods: {
rightIconClick(){
this.$emit('rightClick', this.defaultValue)
},
/** /**
* input事件 * input事件
*/ */