mount() is not working on Field component

I think I'm doing something wrong, even though I put the data, I can't get it on the view side.
14 Replies
toeknee
toeknee2y ago
use viewData() on the field? But as you are using livewire and doing it your way with livewire you access public properties with {{ $record}} and {{$testing}}
Vulture
VultureOP2y ago
Thanks for reply, i fixed listing problem but mount() is not running, i see "before" text on field, im using mount() wrong ?
Vulture
VultureOP2y ago
awcodes
awcodes2y ago
Field isn’t a livewire component so mount won’t have any effect.
Vulture
VultureOP2y ago
Thanks for information 🍀
Vulture
VultureOP2y ago
How can i maniuple $variable like a mount() function on Field ?
Vulture
VultureOP2y ago
i try viewData is not working, not triggering
Dan Harrin
Dan Harrin2y ago
what are you trying to do maybe use setUp() instead of mount() that runs when the field is instantiated
Vulture
VultureOP2y ago
i have Field component, i want get media data and list on field view
Vulture
VultureOP2y ago
Vulture
VultureOP2y ago
how to pass custom variable on view like $media on field component? SetUp() is worked Thanks for helping again! 🍀
Vulture
VultureOP2y ago
Sorry for asking too many questions, i cannot inject record on Field, how to inject ? record is null
Dan Harrin
Dan Harrin2y ago
it isnt available there all public methods on your Field class are available inside the view. public function getMedia() can be called as $getMedia() from the view return your media from there, you can access $this->getRecord() from those public methods
Vulture
VultureOP2y ago
I understand now, thank you very much
Want results from more Discord servers?
Add your server