点击滑动,实现描点,但是要求跳转的过程中有滑动,额,,又基于safari的兼容,,,因此手动计算滑动
toUseDetail () {
// document.querySelector('#luggageInstruction').scrollIntoView({
// behavior: "smooth"
// })
// var el = document.querySelector('#luggageInstruction')
// this.$nextTick(()=> {
// window.scrollTo({
// top: el.offsetTop,
// behavior: "smooth"
// })
// })
this.sh = document.documentElement.scrollTop || document.body.scrollTop
this.scroll(document.querySelector('#luggageInstruction'), 100);
},
scroll(e, frame) {
var eTop = e.getBoundingClientRect().top;
var eAmt = eTop / frame;
var curTime = 0;
while (curTime < frame) {
curTime += 1;
window.setTimeout(this.scrollH, curTime * (200 / frame) , eTop - ((frame - curTime) * eAmt)+this.sh);
}
},
scrollH(height) {
window.scrollTo({
top: height
})
}