1
0
Fork 0
mirror of synced 2024-10-05 12:34:50 +13:00

Fix placeholder text

This commit is contained in:
Andrew Kingston 2021-04-16 09:39:09 +01:00
parent 2e2d1b6738
commit 57f4ebd897

View file

@ -14,11 +14,12 @@
const dispatch = createEventDispatcher()
let open = false
$: isNull = value == null || value === ""
$: placeholderText = placeholder || "Choose an option"
$: selectedOption = options.find(option => getOptionValue(option) === value)
$: selectedLabel = selectedOption
? getOptionLabel(selectedOption)
: placeholderText
$: fieldText = isNull ? placeholder || "Choose an option" : selectedLabel
$: fieldText = isNull ? placeholderText : selectedLabel
const selectOption = value => {
dispatch("change", value)