mirror of
https://github.com/dzeiocom/FormManager.git
synced 2025-04-23 19:32:14 +00:00
Updated datalistinput
Support "" and Fixed some bug
This commit is contained in:
parent
aab4c0bc66
commit
a9d86f6cae
@ -22,10 +22,26 @@ export default class FMDatalistInput extends FMInput {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setValue(value: string) {
|
setValue(value: string) {
|
||||||
|
if (value == "") {
|
||||||
|
this.element.value = ""
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.datalist) {
|
if (this.datalist) {
|
||||||
let option: HTMLOptionElement = this.datalist.querySelector(`[value="${value}"]`)
|
if ((value as any).id != undefined) {
|
||||||
|
value = (value as any).id
|
||||||
|
}
|
||||||
|
let option: HTMLOptionElement = this.datalist.querySelector(`[data-value="${value}"]`)
|
||||||
|
if (option != undefined) {
|
||||||
|
this.element.value = option.value
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (option == undefined && !this.isStrict) {
|
||||||
|
this.element.value = value
|
||||||
|
return
|
||||||
|
}
|
||||||
if (option || !this.isStrict) {
|
if (option || !this.isStrict) {
|
||||||
this.element.value = value
|
this.element.value = value
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user