forked from rc/aircox
code quality
This commit is contained in:
@ -110,7 +110,7 @@ export default {
|
||||
index = Math.min(index, this.items.length-1)
|
||||
return this.items[index]
|
||||
},
|
||||
|
||||
|
||||
selectedValue() {
|
||||
let value = this.itemValue(this.selected)
|
||||
if(!value && !this.mustExist)
|
||||
@ -144,19 +144,19 @@ export default {
|
||||
this.cursor = -1;
|
||||
this.selectedIndex = -1;
|
||||
},
|
||||
|
||||
|
||||
move(index=-1, relative=false) {
|
||||
if(relative)
|
||||
index += this.cursor
|
||||
this.cursor = Math.max(-1, Math.min(index, this.items.length-1))
|
||||
},
|
||||
|
||||
|
||||
select(index=-1, relative=false, active=null) {
|
||||
if(relative)
|
||||
index += this.selectedIndex
|
||||
else if(index == this.selectedIndex)
|
||||
return
|
||||
|
||||
|
||||
this.selectedIndex = Math.max(-1, Math.min(index, this.items.length-1))
|
||||
if(index >= 0) {
|
||||
this.inputValue = this.selectedLabel
|
||||
@ -245,4 +245,3 @@ export default {
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
Reference in New Issue
Block a user