Vue 3
ActiveComposition API + @postio/address-finder mounted via a template ref.
SET UP
Install
npm i @postio/address-finderEXAMPLE
30-second example
vue
<script setup lang="ts"> import { onMounted, ref } from 'vue'; import { setup as setupFinder } from '@postio/address-finder'; const inputEl = ref<HTMLInputElement | null>(null); onMounted(() => { if (!inputEl.value) return; setupFinder({ apiKey: import.meta.env.VITE_POSTIO_KEY, input: inputEl.value, output: { address_line_1: '#line1', post_town: '#town', postcode: '#postcode', }, }); }); </script> <template> <input ref="inputEl" placeholder="Start typing an address…" /> <input id="line1" /> <input id="town" /> <input id="postcode" /> </template>
RELATED