this.$refs
doesn't have any DOM-Elements anymore
#2097
Answered
by
Tim-Wils
fschoenfeldt
asked this question in
5. Bugs
-
So far, I was able to use <div x-data="myData">
<div x-ref="foo" @click="clickToggle"></div>
<div x-ref="bar" @click="clickToggle"></div>
</div> document.addEventListener("alpine:init", () => {
Alpine.data("myData", () => {
clickToggle() {
console.log(this.$refs)
}
});
}); Expected OutputSomething along the lines of {
foo: DOMElement,
bar: DOMElement
} ActualAfter 3.3.4, I get something like a an empty "Proxy" (?) |
Beta Was this translation helpful? Give feedback.
Answered by
Tim-Wils
Sep 21, 2021
Replies: 1 comment 6 replies
-
Try this: |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
fschoenfeldt
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try this:
console.log(this.$root._x_refs);