Problem
I'm working with a Vue CLI application. There is a grandchild component that needs access to another component's element's properties. It really only needs the clientHeight
property.
So Content2.vue component needs access to the clientHeight
property of this element: <div id="header"></div>
(in Header.vue).
Attempted Solutions
I've tried using
$refs
. And according to this stackoverflow answer$refs
are only available to components directly related as parent/child.I've also considered adding the
$refs
orclientHeight
to the store (vuex), but its seems like overkill.I could always go vanilla and use querySelector or getElementById. But thought there may be something better.
Thanks for your help!