I want to create a simple blade component for a people counter. I have to use it multiple times in my Livewre component, and call it with <x-person-counter wire:model="number_adults" />
, <x-person-counter wire:model="number_children" />
My blade component looks like this:
<div x-data="{ counter: 0 }"
@change="$dispatch('input', $event.target.value)">
<input {{ $attributes }} x-ref="input" type="hidden" x-model="counter" />
<div>
<button
type="button"
@click="counter -= 1"
class=""
>-</button>
<div x-text="counter"></div>
<button
type="button"
@click="counter += 1"
>+</button>
</div>
</div>
Inside the component everything works well, but my wire:model field is not updated.
Any help would be appreciated.
Thanks!