Skip to content
This repository was archived by the owner on Sep 24, 2024. It is now read-only.

Commit 5473152

Browse files
julianfoxolefirenko
authored andcommitted
Emit the input focus event (olefirenko#9)
* Emit the input focus event * Complete the doc
1 parent 6988e73 commit 5473152

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ In your template you can use this syntax:
6363
classname="form-control"
6464
placeholder="Start typing"
6565
v-on:placechanged="getFromData"
66+
v-on:focus="onFocus"
6667
>
6768
</vue-google-autocomplete>
6869
```

src/VueGoogleAutocomplete.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
:class="classname"
44
:id="id"
55
:placeholder="placeholder"
6-
@focus = "geolocate()"
6+
@focus = "onFocus()"
77
/>
88
</template>
99

@@ -104,6 +104,10 @@
104104
},
105105
106106
methods: {
107+
onFocus() {
108+
this.geolocate()
109+
this.$emit('focus')
110+
},
107111
// Bias the autocomplete object to the user's geographical location,
108112
// as supplied by the browser's 'navigator.geolocation' object.
109113
geolocate() {

0 commit comments

Comments
 (0)