let count = null; Component({ properties: { inputSharch: { type: Function }, selectSort: { type: Function }, isReverse: Boolean }, data: { isClear: false }, options: { addGlobalClass: true, }, methods: { textChange(e) { clearTimeout(count); if (this.data.isClear) { this.triggerEvent("inputSharch"); this.setData({ isClear: false }) return; } e.type == "change" ? count = setTimeout(() => this.triggerEvent("inputSharch", e.detail.trim()), 1000) : this.triggerEvent("inputSharch", e.detail.trim()); }, onClear() { this.setData({ isClear: true }) }, handleSort() { this.triggerEvent("selectSort") }, } })