Skip to content

zxhm001/vue-location-selector

Repository files navigation

vue-location-selector

A Vue plugin to select location on map

Usage

1. install

npm install git+https://github.com/zxhm001/vue-location-selector.git --save

2. in main.js

import locationSelector from 'vue-location-selector'
Vue.use(locationSelector)

3. in .vue

<location-selector basemap="tianditu" @change="handleChange" amapKey="$amapKEY"/>
<script>
  export default {
    ...
    methods:{
      handleChange(position){
        console.log('position:', position)
      }
    }
    ...
  }
</script>

The location result in param of the callback bind to change event looks like beblow when "change" event fired.

{
  address: '浙江省宁波市宁海县茶院乡科技路',
  lat: 29.28025612868752,
  lng: 29.28025612868752
}

Props

prop type value descrption
basemap String tianditu,amap the type of the base map
initLng Number - the langitude of the center in the inited map
initLat Number - the latitude of the center in the inited map
amapKey String - 高德底图WEBAPIKEY,用于地理反编码,需要自行申请

Events

event name event value description
change Object,{address,lat,lng} the result of the choosen position

Demo

demo

Contributors

How to contribute?

Contact with the author "zxh" and the maintainer "dicl" to get the permission.

Licence

MIT

About

VUE位置选择插件,范围WGS84经纬度坐标以及地址,可选用高德地图或天地图作为底图

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published