Commit f16dcfc1e6763601da9598dfe5a0405255be5ef7
1 parent
32e359df
引入地图
Showing
2 changed files
with
17 additions
and
0 deletions
index.html
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | <meta name="viewport" content="width=1200"> |
| 9 | 9 | <link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico"> |
| 10 | 10 | <title>监控</title> |
| 11 | + <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=cuMSxNl5LOY6sf1M3nDGtG6tGXl5a0Bb"></script> | |
| 11 | 12 | </head> |
| 12 | 13 | <body> |
| 13 | 14 | <div id="app"></div> | ... | ... |
src/views/mapsection.vue
| ... | ... | @@ -30,6 +30,7 @@ |
| 30 | 30 | </div> |
| 31 | 31 | </li> |
| 32 | 32 | </ul> |
| 33 | + <div class="allmap" id="allmap"></div> | |
| 33 | 34 | <ul class="type-wrap"> |
| 34 | 35 | <li>紧张</li> |
| 35 | 36 | <li>正常</li> |
| ... | ... | @@ -81,17 +82,32 @@ export default { |
| 81 | 82 | bounce:true,//取消达到边界的缓冲效果 |
| 82 | 83 | }) |
| 83 | 84 | }) |
| 85 | + this.baiduMap() | |
| 84 | 86 | }, |
| 85 | 87 | methods: { |
| 86 | 88 | currentPark(item, index) { |
| 87 | 89 | console.log(item) |
| 88 | 90 | this.currentIndex = index |
| 91 | + }, | |
| 92 | + baiduMap () { | |
| 93 | + var map = new BMap.Map('allmap') | |
| 94 | + var point = new BMap.Point(111.742579, 40.818675) | |
| 95 | + map.centerAndZoom(point, 12) | |
| 96 | + var marker = new BMap.Marker(point) // 创建标注 | |
| 97 | + map.addOverlay(marker) // 将标注添加到地图中 | |
| 89 | 98 | } |
| 90 | 99 | } |
| 91 | 100 | } |
| 92 | 101 | </script> |
| 93 | 102 | |
| 94 | 103 | <style lang="scss" scoped> |
| 104 | + .allmap{ | |
| 105 | + position: absolute; | |
| 106 | + top:80px; | |
| 107 | + left: 0; | |
| 108 | + right: 0; | |
| 109 | + bottom: 0; | |
| 110 | + } | |
| 95 | 111 | .title-wrap{ |
| 96 | 112 | display: flex; |
| 97 | 113 | padding-top: 17px; | ... | ... |