Commit d59dfa169d42d85a0ac1d4f40fead035b5cea53d
1 parent
4d91ea5c
地图覆盖物
Showing
2 changed files
with
13 additions
and
4 deletions
src/styles/reset.css
@@ -152,5 +152,10 @@ table { | @@ -152,5 +152,10 @@ table { | ||
152 | 152 | ||
153 | .anchorBL{display:none;} /*去掉百度地图logo*/ | 153 | .anchorBL{display:none;} /*去掉百度地图logo*/ |
154 | 154 | ||
155 | - | 155 | +/*.BMap_Marker{*/ |
156 | + /*z-index: 1!important;*/ | ||
157 | +/*}*/ | ||
158 | +/*.BMapLabel{*/ | ||
159 | + /*z-index: 2!important;*/ | ||
160 | +/*}*/ | ||
156 | 161 |
src/views/mapsection.vue
@@ -151,10 +151,12 @@ export default { | @@ -151,10 +151,12 @@ export default { | ||
151 | var marker = new BMap.Marker(pt,{icon:myIcon}); | 151 | var marker = new BMap.Marker(pt,{icon:myIcon}); |
152 | } | 152 | } |
153 | console.log(data) | 153 | console.log(data) |
154 | + marker.setTop(true,27000000); | ||
154 | map.addOverlay(marker); | 155 | map.addOverlay(marker); |
155 | var myLabel; | 156 | var myLabel; |
156 | 157 | ||
157 | - marker.addEventListener("mouseover", function (e) { | 158 | + marker.addEventListener("mouseover", (e)=> { |
159 | + var that = this; | ||
158 | console.log(e) | 160 | console.log(e) |
159 | myLabel = new BMap.Label( | 161 | myLabel = new BMap.Label( |
160 | `<div class="dislog-wrap"> | 162 | `<div class="dislog-wrap"> |
@@ -177,10 +179,12 @@ export default { | @@ -177,10 +179,12 @@ export default { | ||
177 | // whiteSpace: "normal", | 179 | // whiteSpace: "normal", |
178 | backgroundColor: "", | 180 | backgroundColor: "", |
179 | border: "0px", | 181 | border: "0px", |
180 | - // zIndex: "1000" | 182 | + zIndex: "1000" |
181 | } | 183 | } |
182 | ); | 184 | ); |
183 | - map.addOverlay(myLabel); | 185 | + marker.setLabel(myLabel) |
186 | + marker.setTop(true,27000000); | ||
187 | + | ||
184 | }); | 188 | }); |
185 | 189 | ||
186 | marker.addEventListener("mouseout", function (e) { | 190 | marker.addEventListener("mouseout", function (e) { |