1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
| <script>
import BaiduMap from "vue-baidu-map/components/map/Map.vue"; export default{ components:{BaiduMap}, data(){ return{ site_name:'', center:{lng:121.532325,lat:31.232742}, selfKey:'QloR7bQpWed3VDLbtcxi2NmgUcvXxcbx', point:'', zoom:15 } }, mounted(){ this.mapReady() }, methods:{ mapReady(){ var map = new BMap.Map("container") map.centerAndZoom(new BMap.Point(this.center.lng,ths.center.lat),10) map.enableScrollWheelZoom()
var customLayer; customLayer = new BMap.CustomLayer({ geotableId: 183323, q: "", tags: "", filter: "", }); map.addTileLayer(customLayer); customLayer.addEventListener("onhotspotclick", callback); function callback(e) { var customPoi = e.customPoi; var content = '<p style="margin:0;line-height:40px;">地址:' + customPoi.address + "<br/>" + '<a style="color:#3398DB" href="./monitor/index">查看橇装站点实时监控画面</a>' + "</p>"; var BMapLib = window.BMapLib; var searchInfoWindow = new BMapLib.SearchInfoWindow(map, content, { title: customPoi.title, width: 200, height: 100, panel: "panel", enableAutoPan: true, enableSendToPhone: false, searchTypes: [], }); var point = new BMap.Point(customPoi.point.lng, customPoi.point.lat); searchInfoWindow.open(point); } }, search() { var map = new BMap.Map("container"); map.centerAndZoom(new BMap.Point(this.center.lng, this.center.lat), 10); map.enableScrollWheelZoom(); var customLayer; customLayer = new BMap.CustomLayer({ geotableId: 183323, q: this.site_name || "新西北物流园", tags: "", filter: "", }); map.addTileLayer(customLayer);
customLayer.addEventListener("onhotspotclick", callback); function callback(e) { var customPoi = e.customPoi; var content = '<p style="margin:0;line-height:40px;">地址:' + customPoi.address + "<br/>" + '<a style="color:#3398DB" href="./monitor/index">查看橇装站点实时监控画面</a>' + "</p>"; var BMapLib = window.BMapLib; var searchInfoWindow = new BMapLib.SearchInfoWindow(map, content, { title: customPoi.title, width: 200, height: 100, panel: "panel", enableAutoPan: true, enableSendToPhone: false, searchTypes: [], }); var point = new BMap.Point(customPoi.point.lng, customPoi.point.lat); searchInfoWindow.open(point); } }, } } </script>
</details>
|