From fed4f7d3ecbf9daf42e1cd522c995fb089686783 Mon Sep 17 00:00:00 2001 From: les Date: Mon, 7 Jun 2021 00:00:31 +0200 Subject: [PATCH] autocomplete address when importing exact place --- pages/add/WhereInput.vue | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pages/add/WhereInput.vue b/pages/add/WhereInput.vue index 4e624a2f..19204825 100644 --- a/pages/add/WhereInput.vue +++ b/pages/add/WhereInput.vue @@ -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 }) },