Created
November 11, 2021 16:08
-
-
Save SidneyAllen/b5b2097b15c3cd81130bee7e8c65a3ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import { ref } from "vue"; | |
// insert this import | |
import Autocomplete from 'vue3-autocomplete' | |
import useAddressSuggestions from "./useAddressSuggestions"; | |
export default { | |
name: "App", | |
// insert this components Autocomplete | |
components: { | |
Autocomplete | |
}, | |
setup () { | |
const address = ref() | |
const city = ref() | |
const state = ref() | |
const zip = ref() | |
const suggestions = ref([]) | |
const { getSuggestions } = useAddressSuggestions() | |
async function onAddressInput (val) { | |
suggestions.value = await getSuggestions(val) | |
} | |
return { | |
address, | |
city, | |
state, | |
zip, | |
onAddressInput, | |
suggestions, | |
getSuggestions | |
} | |
} | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment