在vue中如何使用leaflet
<template>
<div id="map" class="map">
</div>
</template>
<script>
export default {
data () {
return {
};
},
mounted(){
this.initMaps()
},
methods: {
initMaps () {
const map = L.map('map', {
zoomControl: false,
attributionControl: false
}).setView([39.9042, 116.4074], 10);
L.tileLayer('https://webrd04.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}',).addTo(map)
},
}
}
</script>
<style lang="less" scoped>
.map{
height: 100%;
width: 100%;
}
</style>
参考文档链接: leaflet