Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit 48a0f33

Browse files
committed
Copy actual value for selected option on multiple select
1 parent 3e4bad9 commit 48a0f33

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

resources/js/components/custom-select.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export default function customSelect(config) {
321321
if (this.value.includes(option.value)) {
322322
if (this.optional || this.value.length > 1) {
323323
this.value.splice(this.value.indexOf(option.value), 1);
324-
this.selectedOption.splice(this.selectedOption.findIndex(o => o.value === option.value), 1);
324+
this.selectedOption = [...this.value];
325325
}
326326

327327
if (this.value.length === 0) {
@@ -335,7 +335,7 @@ export default function customSelect(config) {
335335

336336
if (! this.max || Number(this.max) > this.value.length) {
337337
this.value.push(option.value);
338-
this.selectedOption.push(option);
338+
this.selectedOption = [...this.value];
339339
}
340340
},
341341

0 commit comments

Comments
 (0)