安装leaflet
cnpm i leaflet -S
安装vue2-leaflet
cnpm i vue2-leaflet -S
main.js中引入
Vue.config.productionTip = false
import 'leaflet/dist/leaflet.css';
<comment>
平面图标记
传参说明 见props
</comment>
<template>
<div id="leafLet">
<l-map
ref="map"
:zoom="zoom"
:min-zoom="minZoom"
:max-zoom="maxZoom"
:center="center"
:crs="crs"
:options="{zoomControl: false,zoomAnimationThreshold:20}"
:max-bounds="bounds"
style="width:100%;height:600px"
@update:center="centerUpdate"
@update:zoom="zoomUpdate"
>
<!-- 图片的图层 -->
<template>
<l-image-overlay
:url="url"
:bounds="bounds"
:options="{interactive:true}"
@click="addPoint"
/>
</template>
<!-- 标记图层 -->
<template>
<l-marker
v-for="(point,index) in points"
:key="index"
:lat-lng="point"
:visible="showPoint"
:options="{permanent: true}"
>
<!-- <l-icon :icon-url="!point.old&&type=='edit'?warningIcon:primaryIcon" /> -->
<l-to