楼主解决了吗?我也遇到这问题了 之前都没有
setTimeout 报错 undefined, 求解答[代码]onPageScroll(e) {[代码][代码] [代码][代码]if[代码][代码]([代码][代码]this[代码][代码].Sid){[代码][代码] [代码][代码]clearTimeout([代码][代码]this[代码][代码].Sid);[代码][代码] [代码][代码]};[代码][代码] [代码][代码]let st = flag => {[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]isShowBackTop: flag[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]this[代码][代码].Sid = setTimeout(() => {[代码][代码] [代码][代码]let top = [代码][代码]this[代码][代码].data.isShowBackTop;[代码][代码] [代码][代码]if[代码][代码](e && e.scrollTop > 400){[代码][代码] [代码][代码]!top && st([代码][代码]true[代码][代码]);[代码][代码] [代码][代码]}[代码][代码]else[代码][代码]{[代码][代码] [代码][代码]top && st([代码][代码]false[代码][代码]);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]},500);[代码][代码] [代码][代码]},[代码] 错误样例: undefined;at page/hotel/pages/inland/promotions/bargain/index onPageScroll function;at setTimeout callback function 纠结了很久 就是找不到错误原因那!!!! 求官方解答。
2018-10-16