shish 3 weeks ago
parent
commit
77e51c35a7
2 changed files with 10 additions and 2 deletions
  1. 2 2
      ghsApp/src/admin/home/order.vue
  2. 8 0
      ghsApp/src/components/module/app-search.vue

+ 2 - 2
ghsApp/src/admin/home/order.vue

@@ -593,8 +593,8 @@ export default {
       }
     },
     clearSearch() {
-      if (this.$refs.appSearch) {
-        this.$refs.appSearch.inputEmptyFn();
+      if (this.$refs.appSearch && typeof this.$refs.appSearch.inputEmptyFn === 'function') {
+        this.$refs.appSearch.inputEmptyFn()
       }
       this.closeMore();
       this.customId = 0;

+ 8 - 0
ghsApp/src/components/module/app-search.vue

@@ -121,6 +121,14 @@ export default {
 			if (!this.clearOnFocus) {
 				return
 			}
+			this.inputEmptyFn()
+		},
+		// 清空搜索框,供父组件「清空」按钮调用
+		inputEmptyFn() {
+			if (this.timer) {
+				clearTimeout(this.timer)
+				this.timer = null
+			}
 			this.search = ''
 			this.$emit('input', this.search)
 		}