Skip to content

using computed() to deliver window.scrollY as prop for childElement #10047

Discussion options

You must be logged in to vote

I solved it already. The problem was that i was using topvalue instead of topvalue.value (no computed needed)

[...]
let topvalue = ref(0);

//just for checking if the scroll event is listened to properly:
onMounted(() => {
    window.addEventListener("scroll", () => {
        console.log("scroll-listener hinzugefügt");
        console.log(scrollY);
        topvalue.value = scrollY;
    })
})

</script>

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by LinusBorg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant