From e304661b60000c5ef9e5d2087e0b71d501416fd6 Mon Sep 17 00:00:00 2001
From: Jonas Brenig
Date: Fri, 21 Aug 2020 14:48:19 +0200
Subject: [PATCH 1/2] Add ability to define short or long names
---
README.md | 32 +++++++++++++++
example/src/index.html | 10 +++++
src/VueGoogleAutocomplete.vue | 73 ++++++++++++++++++++++++++++-------
3 files changed, 102 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index 573acb9..0d88323 100644
--- a/README.md
+++ b/README.md
@@ -247,3 +247,35 @@ The example below shows the correct usage of the `types` parameter, when limitin
>
```
+
+#### Manually setting short_name / long_name
+
+Sometimes you want to use the `short_name` instead of the `long_name` or vice-versa.
+For example in the case of `country` it is helpful to get the iso code (`short_name`) to store it in your database.
+
+You can do so by passing an object to the component.
+
+**Note:** At this moment it is only possible to pass a complete object to the component. So it's not possible to override just specific address-components.
+
+```html
+
+
+```
diff --git a/example/src/index.html b/example/src/index.html
index 1d9544c..6447aa4 100644
--- a/example/src/index.html
+++ b/example/src/index.html
@@ -30,6 +30,16 @@ Start typing an address and below you will see found resu
v-on:placechanged="getAddressData"
v-on:error="handleError"
country="sg"
+ v-bind:address-components="{
+ subpremise: 'short_name',
+ street_number: 'short_name',
+ route: 'long_name',
+ locality: 'long_name',
+ administrative_area_level_1: 'short_name',
+ administrative_area_level_2: 'long_name',
+ country: 'short_name',
+ postal_code: 'short_name',
+ }"
>
diff --git a/src/VueGoogleAutocomplete.vue b/src/VueGoogleAutocomplete.vue
index bd4dde8..d2bb8fa 100644
--- a/src/VueGoogleAutocomplete.vue
+++ b/src/VueGoogleAutocomplete.vue
@@ -15,17 +15,6 @@