[add] tn-input 加入防抖功能

This commit is contained in:
aisen
2025-09-17 18:22:40 +08:00
parent 5ba0d32004
commit 5186a277e1
+6 -3
View File
@@ -114,6 +114,9 @@
<script> <script>
import Emitter from '../../libs/utils/emitter.js' import Emitter from '../../libs/utils/emitter.js'
import {
debounceFun
} from '../../libs/function/applyEven.js'
export default { export default {
mixins: [Emitter], mixins: [Emitter],
@@ -334,7 +337,7 @@
/** /**
* input事件 * input事件
*/ */
handleInput(event) { handleInput:debounceFun(function(event){
let value = event.detail.value let value = event.detail.value
// 是否需要去掉空格 // 是否需要去掉空格
if (this.trim) value = this.$tn.string.trim(value) if (this.trim) value = this.$tn.string.trim(value)
@@ -351,11 +354,11 @@
if (this.$tn.string.trim(value) === this.lastValue) return if (this.$tn.string.trim(value) === this.lastValue) return
this.lastValue = value this.lastValue = value
// #endif // #endif
// 发送当前的值到form-item进行校验 // 发送当前的值到form-item进行校验
this.dispatch('tn-form-item','on-form-change', value) this.dispatch('tn-form-item','on-form-change', value)
}, 40) }, 40)
}, },this.blockTime),
/** /**
* blur事件 * blur事件
*/ */