看了很多要么没用要么用插件 发现一个参数visualViewport该对象表示当前窗口的可视视口
const a = window
onMounted(() => {
window.addEventListener('scroll', doScroll, true)
})
onUnmounted(() => {
el.removeEventListener("scroll", doScroll)
})
const doScroll = (event) => {
console.log('距离顶部距离', a.visualViewport.pageTop)
// console.log(event.target.scrollTop, '1111');
}