$root not returning the root #4605
Replies: 3 comments 2 replies
-
$root return the closest element having x-data, starting from the element itself so it works as expected since you have x-data on your div#notRoot As a separate note, you don't need $root, the child component has direct access to the parent properties get expanded() {
return this.active === this.id;
},
set expanded(value) {
this.active = value ? this.id : null;
} |
Beta Was this translation helpful? Give feedback.
-
As mentioned you're just expecting it to work differently. It returns the ELEMENT, not the state there, also, you were using directly You could do |
Beta Was this translation helpful? Give feedback.
-
Ah It works now. Easier than expected. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey
My Problem: I need to toggle a container outside the scope. Therefor, I use the $root magic. But it turns out to just return the $el not the $root.
Am I using it wrong?
I have [email protected] installed.
Log:
Beta Was this translation helpful? Give feedback.
All reactions