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)
	},
上一篇:react路由传参的几种方式


下一篇:爬取三国演义的章节和内容