livewire-select
livewire-select copied to clipboard
TypeError: component.data.optionsValues is undefined into selectDown(component)
I have an error when I using the down arrow.
Alpine Error: "TypeError: component.data.optionsValues is undefined"
Expression: "selectDown(window.livewire.find('qGYXZk93tJhwpOf1TVQe'))"
Line 23: select.blade.php
selectDown(component) { if (component.data.optionsValues.length - 1 === this.selectedIndex) { return } this.selectedIndex++ },
I found the error:
component not have "data" attribute, and only need valuate component.optionValues.
In a LivewireSelect component the variable only is optionValues.
selectDown(component) {
if (component.optionsValues.length - 1 === this.selectedIndex) {
return
}
this.selectedIndex++
},
selectIndex(index) {
this.selectedIndex = index
this.isOpen = true
},
confirmSelection(component) {
const value = component.optionsValues.length === 1
? component.optionsValues[0]
: component.optionsValues[this.selectedIndex]
if (!value) {
return
}
component.set('value', value)
this.selectedIndex = -1
this.isOpen = true
},
....
Testing: "laravel/framework": "^8.12" "livewire/livewire": "^2.0"