【发布时间】:2020-05-21 18:17:46
【问题描述】:
我需要使用 vuejs 在传单地图中显示多个标记。而且我还需要更改标记图像,我在下面只为单个制造商提供了代码。
mounted () {
// L.Icon.Default.imagePath = 'assets/vendor/leaflet' TODO: make it work with webpack
Leaflet.Icon.Default.imagePath = 'https://unpkg.com/leaflet@1.0.3/dist/images'
let map = Leaflet.map(this.$refs['mapElement']).setView([51.505, -0.09], 13)
Leaflet.tileLayer('https://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://osm.org/copyright">OpenStreetMap</a> contributors',
}).addTo(map)
Leaflet.marker([51.5, -0.09]).addTo(map)
.openPopup()
},
下面是我的api输出数据
[[51.4, -0.03],[53.5, -0.39],[52.5, -0.39]]
【问题讨论】:
标签: javascript google-maps dictionary vue.js leaflet