Elements-SY

Merge branch 'fix-issues' into uat

......@@ -223,7 +223,7 @@ export function getTime(type) {
* @return {*}
*/
export function debounce(func, wait, immediate) {
let timeout, args, context, timestamp, result;
let timeout, args, context, timestamp, result, data;
const later = function () {
// 据上一次触发时间间隔
......@@ -236,7 +236,7 @@ export function debounce(func, wait, immediate) {
timeout = null;
// 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用
if (!immediate) {
result = func.apply(context, args);
result = func.apply(context, data);
if (!timeout) context = args = null;
}
}
......@@ -245,6 +245,7 @@ export function debounce(func, wait, immediate) {
return function (...args) {
context = this;
timestamp = +new Date();
data = args;
const callNow = immediate && !timeout;
// 如果延时不存在,重新设定延时
if (!timeout) timeout = setTimeout(later, wait);
......
This diff is collapsed. Click to expand it.