// 节流 export const throttle = function (fn, delay = 300) { var lastTime, timer; return function () { var _this = this; var args = arguments; var nowTime = Date.now(); if (lastTime && nowTime - lastTime < delay) { if (timer) clearTimeout(timer); timer = setTimeout(function () { lastTime = nowTime; fn.apply(_this, args); }, delay); } else { lastTime = nowTime; fn.apply(_this, args); } }; };