livewire コンポーネントに select2 があります。すべて正常に動作しますが、私の編集ビューでは、選択したオプションがボックスに表示されません。ドロップダウンを開くと、強調表示されているので、データはバックエンドから来ています。
<div wire:ignore class="col-8">
<select wire:model="notificationType" class="form-control select2 text-sm"
multiple="multiple">
@foreach($notificationTypeOptions as $key => $option)
<option value="{{ $key }}">{{ $option }}</option>
@endforeach
</select>
</div>
$('.select2').select2({
width: '100%',
tags: true,
multiple: "multiple",
});
$('.select2').on('change', function (e) {
var data = $('.select2').val();
@this.set('notificationType', data);
});
誰かが助けてくれたらお願いします...