Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(taro-h5): 修复pageScrollTo方法滚动的实际位置与给定的目标位置不符 #6059

Merged
merged 7 commits into from
Jul 31, 2020
3 changes: 2 additions & 1 deletion packages/taro-h5/src/api/scroll/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const pageScrollTo = ({ scrollTop, duration = 300, success, fail, complet
const to = scrollTop
const delta = to - from

const frameCnt = duration / FRAME_DURATION
const frameCnt = duration / FRAME_DURATION - 1
const easeFunc = getTimingFunc(easeInOut, frameCnt)

const scroll = (frame = 0) => {
Expand All @@ -64,6 +64,7 @@ export const pageScrollTo = ({ scrollTop, duration = 300, success, fail, complet
const res = {
errMsg: 'pageScrollTo:ok'
}
scrollFunc(to)
success && success(res)
complete && complete(res)
resolve(res)
Expand Down