$data equivalent in v3 #1979
Replies: 3 comments 3 replies
-
I think I'm not sure about the Livewire approach though, I'm not very familiar with it. |
Beta Was this translation helpful? Give feedback.
-
Why do you need to pass $data? All variables are already available in init (e.g. |
Beta Was this translation helpful? Give feedback.
-
@SimoTod I use the variables in a I think @kylethielk his approach is cleaner than mine, so I'll try to incorporate the Livewire aspect in it and see if that works |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
In v2 I could use '$data' in my x-init to access the x-data object. After upgrading to V3 this did not seem to work anymore. I figured out a way to access the data object
$refs.component._x_dataStack[0]
, but I don't think that's how it should be.I use Laravel Livewire @entangle in my x-data object, so to move it to Alpine.data() on alpine:init I would have to make a hacky solution as well as far as my knowledge goes. Something like this:
I used to pass the $data variables to a function on init that calculates if it should show buttons for a scroll/slider, and manipulate the data accordingly.
Any help would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions