autocomplete address when importing exact place

This commit is contained in:
les 2021-06-07 00:00:31 +02:00
parent 00e8e0bd37
commit fed4f7d3ec
No known key found for this signature in database
GPG key ID: 352918250B012177

View file

@ -76,10 +76,17 @@ export default {
this.disableAddress = true
} else { // this is a new place
this.place.name = p.name || p
this.place.address = ''
this.disableAddress = false
this.$refs.place.blur()
this.$refs.address.focus()
// search for a place with the same name
const place = this.places.find(p => p.name === this.place.name)
if (place) {
this.place.address = place.address
this.disableAddress = true
} else {
this.place.address = ''
this.disableAddress = false
this.$refs.place.blur()
this.$refs.address.focus()
}
}
this.$emit('input', { ...this.place })
},