npm install vue-leaflet-location-select
or
yarn add vue-leaflet-location-select
import SelectLocation from "vue-leaflet-location-select";
import "vue-leaflet-location-select/library/vue-leaflet-location-select.css";
//
components: {'select-location': SelectLocation}
//
components { 'my-component': () => import('vue-leaflet-location-select')}
}
<template lang="pug">
div
p
div(style="width: 480px; height: 28px; margin: 0 auto")
select-location(v-model="location" :width="480" dialogWidth="600px" :toFixedNum="8")
</template>
props
|
|
|
|
|
mapConfig |
MapConfig |
|
-- |
|
valuev-model |
Array |
|
[] |
|
mapId |
String |
map |
'map' |
|
dialogWidth |
String |
|
'600px' |
|
toFixedNum |
Number |
|
6 |
|
isInput |
Boolean |
() |
true |
|
disable |
Boolean |
|
false |
|
width |
Number |
|
320 |
|
customSearchFunction |
() => void |
(BaseLocation) |
(searchStr):BaseLocation[] => {return []} |
|
BaseLocation
location: string = ''; // "120.22132,30.207384"
detailAddress?: string = ""; //
name?: string = ""; //
MapConfig
mapCenter: Array<number | string> = [30.257881, 120.195923]; //
url?: string = "http://{s}.tile.osm.org/{z}/{x}/{y}.png";
maxZoom?: number = 18; //
minZoom?: number = 5; //
zoom?: number = 14; //
isSearch?: boolean = true;
searchConfigKey?: string = '9cb097cec23e465d5916ef63f23798db'; // key
searchConfigUrl?: string = 'http://restapi.amap.com/v3/place/text';
event
method
|
|
|
clearValue |
-- |
value |
destroyMap |
-- |
|
slot
- leaflet.js
- EPSG3857
- elementui
-
-