其他分享
首页 > 其他分享> > input框 模糊搜索节流方法

input框 模糊搜索节流方法

作者:互联网

<input v-model="amount" type="number" @input="throttle" placeholder="javascript" size="large"
					class="" />
	// 调用接口获取模糊数据
	giveIntegralTotal() {
		let obj = {}
		this.$http.giveIntegralTotal(this.amount).then(res => {
			console.log(res)
		})
	},
	//节流函数
	throttle(e) {
		console.log(99999,e.detail.value)
		this.amount = e.detail.value
		//保持this的指向始终指向vue实例
		var that = this;
		if (!that.statu) {
			return;
		}
		that.statu = false;
		setTimeout(function() {
			console.log(new Date());
			that.giveIntegralTotal();
			that.statu = true;
		}, 1500)
	},

标签:statu,console,节流,res,detail,giveIntegralTotal,搜索,input,log
来源: https://blog.csdn.net/weixin_49186680/article/details/115406782