Commit 6ddbf1c2 authored by youjie's avatar youjie

no message

parent e61b8413
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
border-radius: 8px;} border-radius: 8px;}
</style> </style>
<template> <template>
<div>
<div class="card" :id="`baidu-map_${center.Id}`"></div> <div class="card" :id="`baidu-map_${center.Id}`"></div>
</div>
</template> </template>
<script> <script>
export default { export default {
...@@ -17,7 +19,8 @@ ...@@ -17,7 +19,8 @@
center:{ center:{
Lng: 116.294625, Lng: 116.294625,
Lat: 39.961627 Lat: 39.961627
} },
keywords: ''
} }
}, },
watch: { watch: {
...@@ -27,6 +30,11 @@ ...@@ -27,6 +30,11 @@
}, },
deep:true, deep:true,
immediate:true immediate:true
},
keywords:{
handler(newValue,onldValue) {
this.getLocalSearch()
},
} }
}, },
mounted() { mounted() {
...@@ -74,7 +82,7 @@ ...@@ -74,7 +82,7 @@
offset: new BMapGL.Size(10, -60), // 设置标注的偏移量 offset: new BMapGL.Size(10, -60), // 设置标注的偏移量
}); });
this.map.addOverlay(label); // 将标注添加到地图中 this.map.addOverlay(label); // 将标注添加到地图中
label.addEventListener("click", function () { label.addEventListener("click", function (e) {
// alert("您点击了标注"); // alert("您点击了标注");
}); });
label.setStyle({ label.setStyle({
...@@ -90,7 +98,12 @@ ...@@ -90,7 +98,12 @@
var mPoint = new BMapGL.Point(this.center.Lng, this.center.Lat); var mPoint = new BMapGL.Point(this.center.Lng, this.center.Lat);
var circle = new BMapGL.Circle(mPoint,this.center.Range,{fillColor:"blue", strokeWeight: 1 ,fillOpacity: 0.3, strokeOpacity: 0.3}); var circle = new BMapGL.Circle(mPoint,this.center.Range,{fillColor:"blue", strokeWeight: 1 ,fillOpacity: 0.3, strokeOpacity: 0.3});
this.map.addOverlay(circle); this.map.addOverlay(circle);
} },
getLocalSearch(){
var mPoint = new BMapGL.Point(this.center.Lng, this.center.Lat);
var local = new BMapGL.LocalSearch(this.map, {renderOptions: {map: this.map, autoViewport: false}});
local.searchNearby(this.keywords,mPoint,this.center.Range);
},
}, },
} }
</script> </script>
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment