|
@@ -85,6 +85,7 @@ Page({
|
|
|
classId: "",
|
|
classId: "",
|
|
|
className: "",
|
|
className: "",
|
|
|
|
|
|
|
|
|
|
+ timer: null as any,
|
|
|
isSaveDisable: false
|
|
isSaveDisable: false
|
|
|
},
|
|
},
|
|
|
async onLoad(options: any) {
|
|
async onLoad(options: any) {
|
|
@@ -298,8 +299,16 @@ Page({
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
onSearchChange(e: any) {
|
|
onSearchChange(e: any) {
|
|
|
- this.setData({
|
|
|
|
|
|
|
+ const that = this
|
|
|
|
|
+ that.setData({
|
|
|
searchName: e.detail
|
|
searchName: e.detail
|
|
|
|
|
+ }, () => {
|
|
|
|
|
+ // 防抖
|
|
|
|
|
+ clearTimeout(that.data.timer); // 清除之前的定时器
|
|
|
|
|
+ that.data.timer = setTimeout(() => {
|
|
|
|
|
+ that.getSchools(that.data.searchName);
|
|
|
|
|
+ // 这里写业务逻辑
|
|
|
|
|
+ }, 500);
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
onSearch() {
|
|
onSearch() {
|