/vue-thailand-address-autocomplete

ðŸ‡đ🇭 Autocomplete āļ—āļĩāđˆāļ­āļĒāļđāđˆāđƒāļ™āļ›āļĢāļ°āđ€āļ—āļĻāđ„āļ—āļĒ

Primary LanguageVueMIT LicenseMIT

⛔ïļ DEPRECATED This repo has not been maintained

NPM version NPM downloads License Demo Build Status

Vue Thailand Address Autocomplete ðŸ‡đ🇭

Auto complete āļ—āļĩāđˆāļ­āļĒāļđāđˆāđƒāļ™āļ›āļĢāļ°āđ€āļ—āļĻāđ„āļ—āļĒāđāļšāļšāļŠāļģāđ€āļĢāđ‡āļˆāļĢāļđāļ›

Base on jquery.Thailand.js and thai-address-database

Very well database by @earthchie

Demo Page

Documentation & Demo Page

Install

npm install vue-thailand-address-autocomplete --save

āļŦāļĢāļ·āļ­

yarn add vue-thailand-address-autocomplete

Usage

import ThailandAutoComplete from 'vue-thailand-address-autocomplete'

Vue.component('ThailandAutoComplete', ThailandAutoComplete)

āļŦāļĢāļ·āļ­

import ThailandAutoComplete from 'vue-thailand-address-autocomplete'

export default {
  components: {
    ThailandAutoComplete
  }
}

Example

<template>
  <div>
    <ThailandAutoComplete
      v-model="district"
      type="district"
      @select="select"
      label="āļ•āļģāļšāļĨ"
      color="#42b883"
      size="default"
      placeholder="āļ•āļģāļšāļĨ..."/>

    <ThailandAutoComplete v-model="amphoe" type="amphoe" @select="select" label="āļ­āļģāđ€āļ āļ­" placeholder="āļ­āļģāđ€āļ āļ­..."/>

    <ThailandAutoComplete v-model="province" type="province" @select="select" label="āļˆāļąāļ‡āļŦāļ§āļąāļ”" size="medium" color="#35495e" placeholder="āļˆāļąāļ‡āļŦāļ§āļąāļ”..."/>

    <ThailandAutoComplete v-model="zipcode" type="zipcode" @select="select" size="large" color="#00a4e4" placeholder="āļĢāļŦāļąāļŠāđ„āļ›āļĢāļĐāļ“āļĩāļĒāđŒ..."/> 
  </div>
</template>

<script>
export default {
  data () {
    return {
      district: '',
      amphoe: '',
      province: '',
      zipcode: ''
    }
  },
  methods: {
    select (address) {
      this.district = address.district
      this.amphoe = address.amphoe
      this.province = address.province
      this.zipcode = address.zipcode
    }
  }
}
</script>

Options

Props

Props Type Default Description
v-model String - Binding value
type String - āļ›āļĢāļ°āđ€āļ āļ—āļ‚āļ­āļ‡ Field āļ›āļĢāļ°āļāļ­āļšāļ”āđ‰āļ§āļĒ district, amphoe, province, zipcode
label String - āļ„āļģāļ­āļ˜āļīāļšāļēāļĒāļ‚āļ­āļ‡ Field
placeholder String - placeholder āļ‚āļ­āļ‡ Field
color String - āļŠāļĩ border āļ‚āļ­āļ‡ Field āļ•āļ­āļ™ Focus āđāļĨāļ°āļŠāļĩ background āļ‚āļ­āļ‡ List
size String default āļ‚āļ™āļēāļ”āļ‚āļ­āļ‡ Field āļ›āļĢāļ°āļāļ­āļšāļ”āđ‰āļ§āļĒ small, default, medium, large

Events

Events Type Default Description
select Function (address) => {} Return address data (type object) when select address, āļ„āļ·āļ™āļ„āđˆāļē Object āļ—āļĩāđˆāļ­āļĒāļđāđˆāđ€āļĄāļ·āđˆāļ­āđ€āļĨāļ·āļ­āļāļ—āļĩāđˆāļ­āļĒāļđāđˆāļˆāļēāļ Autocomplete

Contributing

  1. Fork this repository.
  2. Create new branch with feature name.
  3. Run npm install and npm run dev.
  4. Create your feature.
  5. Commit and set commit message with feature name.
  6. Push your code to your fork repository.
  7. Create pull request. 🙂

Support

If you like this project, You can support me with starring ⭐ this project.

License

MIT

Developed with âĪïļ and ☕ïļ