Closed hardevine closed 5 months ago
class CentreForm extends Component { public $centre = [ 'country' => '', ]; #[Computed] public function countryList() { $c = collect(countryList())->mapWithKeys(fn($item, $key) => [$item => $item]); return $c->toArray(); } #[Computed] public function statesList() { $cc = countryCode($this->centre['country']); $c = stateList($cc); return $c; } public function updatedCentreCountry() { $this->centre['state'] = ''; }
<div x-data="{ value: @entangle($attributes->wire('model')).live, }" x-init="new SlimSelect({ select: $refs.simple_select, settings: {searchHighlight: true} }).setSelected(value,false)" x-on:afterChange="value = $event.target.value" {{ $attributes->whereDoesntStartWith('wire:model') }} wire:ignore > <select x-model="value" x-ref="simple_select" {{ $attributes->whereDoesntStartWith('wire:model')->merge(['class' => '']) }}> <option value="">-</option> {{ $slot }} @foreach($options as $key => $value) <option value="{{ $key }}">{{ $value }}</option> @endforeach </select> </div>
Sorry i cannot control what livewire does to slim select. I dont even know if its compatable.