olefirenko / vue-google-autocomplete

A Vue.js autosuggest component for the Google Places API.
https://olefirenko.github.io/vue-google-autocomplete/
MIT License
505 stars 258 forks source link

How to use events in Vue 3 Composition #191

Open emp-sean opened 1 year ago

emp-sean commented 1 year ago

Anyone able to shed some light on how to use the events with the composite API of Vue 3.

Needing to use the clear functionality.

christine927t commented 6 months ago

@emp-sean I got this working by doing the following:

Added ref="address" to the vue-google-autocomplete element <vue-google-autocomplete id="editAddressStreet3" ref="address" v-model="props.editAddress.street" placeholder="Address line 1" v-on:placechanged="getAddressData"></vue-google-autocomplete>

declared the ref in my script setup: let address = ref('')

called the clear function in my code: address.value.clear()