TypeError: Failed to execute 'scrollTo' on 'Window'

340 阅读1分钟

TypeError: Failed to execute 'scrollTo' on 'Window': No function was found that matched the signature provided.

部分浏览器使用下列代码会报错

window.scrollTo({top: 180})

解决方法

window.scrollTo(0, 180)

image.png