【发布时间】:2018-08-02 20:10:37
【问题描述】:
我将地理点存储到一个数组中,现在我想在谷歌地图上输出这些,但它不起作用。没有为新地理点设置标记。
需要帮助,如何在地图上为地理点设置标记?
firestore 数据库:
代码:
mounted () {
var map = new google.maps.Map(document.getElementById('mapName'), {
center: {lat: 0, lng: 0},
zoom: 20
});
fb.usersCollection.where("acctPosition", "==", true).get().then(docs => {
docs.forEach((coord) => {
const position = new google.maps.LatLng(coord.latitude,coord.longitude);
const marker = new google.maps.Marker({
position,
map: map
});
})
})
}
这是console.log(coord.data())的输出
有了这个地理点,我想在谷歌地图中设置一个标记。如何做到这一点?
【问题讨论】:
标签: javascript google-maps firebase vue.js google-cloud-firestore