1.app.vue中设置globalData
globalData: {
delayedSearchTimeOutMs: 500, //触发时间
},
2.单独页面中
2.1定义变量
searchInputTimeOutId: undefined,
2.2设置方法:
//输入框搜索(延时搜索设置)
delayedSearch: function() {
clearTimeout(this.searchInputTimeOutId);
this.searchInputTimeOutId = setTimeout(() => {
this.$refs.paging.reload();
}, getApp().globalData.delayedSearchTimeOutMs)
},