返回頂部按鈕添加goUp事件
goUp(){
let nowTop = document.body.scrollTop || document.documentElement.scrollTop; // 獲取當(dāng)前滾動(dòng)條位置
if (nowTop > 0) {
window.requestAnimationFrame(this.goUp);
window.scrollTo (0,nowTop - (nowTop/5));
}
}