Fix placeholder text
This commit is contained in:
parent
917f0551d5
commit
e28bbf594b
|
@ -14,11 +14,12 @@
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
let open = false
|
let open = false
|
||||||
$: isNull = value == null || value === ""
|
$: isNull = value == null || value === ""
|
||||||
|
$: placeholderText = placeholder || "Choose an option"
|
||||||
$: selectedOption = options.find(option => getOptionValue(option) === value)
|
$: selectedOption = options.find(option => getOptionValue(option) === value)
|
||||||
$: selectedLabel = selectedOption
|
$: selectedLabel = selectedOption
|
||||||
? getOptionLabel(selectedOption)
|
? getOptionLabel(selectedOption)
|
||||||
: placeholderText
|
: placeholderText
|
||||||
$: fieldText = isNull ? placeholder || "Choose an option" : selectedLabel
|
$: fieldText = isNull ? placeholderText : selectedLabel
|
||||||
|
|
||||||
const selectOption = value => {
|
const selectOption = value => {
|
||||||
dispatch("change", value)
|
dispatch("change", value)
|
||||||
|
|
Loading…
Reference in New Issue