input 全局设置 延时搜索

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)
},

猜你喜欢

转载自blog.csdn.net/weixin_44805839/article/details/133646373
今日推荐