A Vue plugin to select location on map
npm install git+https://github.com/zxhm001/vue-location-selector.git --save
import locationSelector from 'vue-location-selector'
Vue.use(locationSelector)
<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
}
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,用于地理反编码,需要自行申请 |
event name | event value | description |
---|---|---|
change | Object,{address,lat,lng} | the result of the choosen position |
- ZXHM
- dicl
How to contribute?
Contact with the author "zxh" and the maintainer "dicl" to get the permission.
MIT