<template lang="html">
<baidu-map :center="BDMap.center" @ready="handler" :zoom="BDMap.zoom" class="bm-view">
<bm-marker
v-for="point in pointList"
:position="{lng: point.lng, lat: point.lat}">
</bm-marker>
<!-- 以下部分放开会报错 -->
<!-- <bm-navigation anchor="BMAP_ANCHOR_TOP_RIGHT" />
<bm-geolocation anchor="BMAP_ANCHOR_BOTTOM_RIGHT" :showAddressBar="true" :autoLocation="true"/> -->
</baidu-map>
</template>
<script type="text/javascript">
export default {
data() {
return {
BDMap: {
center: {
lng: 116.404,
lat: 39.955
},
zoom: 12
},
pointList: [{
lng: 116.414,
lat: 39.915,
}, {
lng: 116.424,
lat: 39.915,
}]
}
},
methods: {
handler() {
this.pointList.push({
id: 1,
lng: 116.524,
lat: 39.955
})
}
}
}
</script>
<style scoped>
.bm-view {
width: 100%;
height: 300px;
}
</style>
vue.esm.js?65d7:467 DOMException: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.
at Object.insertBefore (eval at <anonymous> (http://localhost:2001/app.js:810:1), <anonymous>:4407:14)
at insert (eval at <anonymous> (http://localhost:2001/app.js:810:1), <anonymous>:4713:17)
at createElm (eval at <anonymous> (http://localhost:2001/app.js:810:1), <anonymous>:4643:7)
at VueComponent.patch [as __patch__] (eval at <anonymous> (http://localhost:2001/app.js:810:1), <anonymous>:5054:7)
at VueComponent.Vue._update (eval at <anonymous> (http://localhost:2001/app.js:810:1), <anonymous>:2034:19)
at VueComponent.updateComponent (eval at <anonymous> (http://localhost:2001/app.js:810:1), <anonymous>:2157:10)
at Watcher.get (eval at <anonymous> (http://localhost:2001/app.js:810:1), <anonymous>:2468:25)
at new Watcher (eval at <anonymous> (http://localhost:2001/app.js:810:1), <anonymous>:2451:12)
at mountComponent (eval at <anonymous> (http://localhost:2001/app.js:810:1), <anonymous>:2161:17)
at init (eval at <anonymous> (http://localhost:2001/app.js:810:1), <anonymous>:2930:13)
logError @ vue.esm.js?65d7:467