Skip to content

Places component is based on places.js for Vue 2.x. Turn any <input> into an address autocomplete.

License

Notifications You must be signed in to change notification settings

Gomah/vue-places

Repository files navigation

vue-places

Places component is based on places.js for Vue 2.x.

Turn any into an address autocomplete

circle-ci npm version Dependencies npm downloads code style: prettier License: MIT


Installation

# yarn
$ yarn add vue-places

# npm
$ npm install vue-places --save

Example

<template>
  <places
    v-model="form.country.label"
    placeholder="Where are we going ?"
    @change="val => { form.country.data = val }"
    :options="options">
  </places>
</template>

<script>
import Places from 'vue-places';

export default {
  data() {
    return {
      options: {
        appId: <YOUR_PLACES_APP_ID>,
        apiKey: <YOUR_PLACES_API_KEY>,
        countries: ['US'],
      },
      form: {
        country: {
          label: null,
          data: {},
        },
      },
    };
  },
  components: {
    Places,
  },
}
</script>

Algolia Places Documentation