V3 x-show doesn't evaluate properly off xref values #1709
-
The following code snippet was working in V2, but in V3 seems to do nothing and I am unsure why If you type anything into the input other than 'en' the text should display, instead the text never shows up at all
Here's a codepen showing it in action: Any support would be appreciated |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
Your code doesn't really make sense because inputname.value isn't reactive so there is no way for alpine to track it. Maybe use x-model on the input instead? https://codepen.io/danddanddand/pen/mdmJNNz |
Beta Was this translation helpful? Give feedback.
-
Here's a plugin for the v2 style Alpine.magic('v2refs', (el, { Alpine: { closestRoot } }) => {
const root = closestRoot(el)
return new Proxy({}, {
get(_, prop) {
return root.querySelector(`[x-ref=${prop}]`)
}
})
}) Demo: https://codepen.io/KevinBatdorf/pen/VwbvZBR?editors=1010 |
Beta Was this translation helpful? Give feedback.
Here's a plugin for the v2 style
$refs
, where you would use like$v2refs.something.value
Demo: https://codepen.io/KevinBatdorf/pen/VwbvZBR?editors=1010