vue absolute元素随横向滚动条滚动
配合js做监听```js
const scrollListener = () => {
const topHeight = getScrollTop();
if (topHeight === 0) {
scrollIsTop.value = true;
} else {
scrollIsTop.value = false;
}
scrollLeft.value =
Math.max(document.body.scrollLeft, document.documentElement.scrollLeft) +
"px";
};
onMounted(() => {
window.addEventListener("scroll", scrollListener);
});
onUnmounted(() => {
window.removeEventListener("scroll", scrollListener);
});
scrollListener();
```
页:
[1]