vue-防抖函数

然荻读书 / 2023-07-20 / 原文

throttle(fn, delay) {
			let t = true
			return function () {
				if (t) {
					setTimeout(() => {
						fn.call(this)
						t = true
					}, delay)
				}
				t = false;
			}
		}