globally access specific / tagged elements #10305
Unanswered
PierreSchwang
asked this question in
Help/Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! I'm looking for a more "Vue-like" way to access specific elements (in particular their BoundingClientRect) - especially if they are in another component (due to routing).
Basically, what I'm having my App.vue including a Navigation and the RouterView. The pages / routes itself contain multiple sections with different background-colors. The navigation should adjust it's color accordingly to match those.
For now, I'm simply using the scroll event listener, request an animation frame and check which sections bounding rect overlaps with the navigation. What I'm not really happy with, is how I'm retrieving the individual sections from all rendered components - I'm basically querySelectorAll in nextTick:
Is there something more appropriate for such a use-case?
Beta Was this translation helpful? Give feedback.
All reactions