Commit f16dcfc1e6763601da9598dfe5a0405255be5ef7

Authored by liuqimichale
1 parent 32e359df

引入地图

index.html
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 <meta name="viewport" content="width=1200"> 8 <meta name="viewport" content="width=1200">
9 <link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico"> 9 <link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico">
10 <title>监控</title> 10 <title>监控</title>
  11 + <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=cuMSxNl5LOY6sf1M3nDGtG6tGXl5a0Bb"></script>
11 </head> 12 </head>
12 <body> 13 <body>
13 <div id="app"></div> 14 <div id="app"></div>
src/views/mapsection.vue
@@ -30,6 +30,7 @@ @@ -30,6 +30,7 @@
30 </div> 30 </div>
31 </li> 31 </li>
32 </ul> 32 </ul>
  33 + <div class="allmap" id="allmap"></div>
33 <ul class="type-wrap"> 34 <ul class="type-wrap">
34 <li>紧张</li> 35 <li>紧张</li>
35 <li>正常</li> 36 <li>正常</li>
@@ -81,17 +82,32 @@ export default { @@ -81,17 +82,32 @@ export default {
81 bounce:true,//取消达到边界的缓冲效果 82 bounce:true,//取消达到边界的缓冲效果
82 }) 83 })
83 }) 84 })
  85 + this.baiduMap()
84 }, 86 },
85 methods: { 87 methods: {
86 currentPark(item, index) { 88 currentPark(item, index) {
87 console.log(item) 89 console.log(item)
88 this.currentIndex = index 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 </script> 101 </script>
93 102
94 <style lang="scss" scoped> 103 <style lang="scss" scoped>
  104 + .allmap{
  105 + position: absolute;
  106 + top:80px;
  107 + left: 0;
  108 + right: 0;
  109 + bottom: 0;
  110 + }
95 .title-wrap{ 111 .title-wrap{
96 display: flex; 112 display: flex;
97 padding-top: 17px; 113 padding-top: 17px;