From d59dfa169d42d85a0ac1d4f40fead035b5cea53d Mon Sep 17 00:00:00 2001 From: liuqimichale <123456lq> Date: Fri, 14 Dec 2018 15:23:06 +0800 Subject: [PATCH] 地图覆盖物 --- src/styles/reset.css | 7 ++++++- src/views/mapsection.vue | 10 +++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/styles/reset.css b/src/styles/reset.css index c7621e0..42a06a8 100644 --- a/src/styles/reset.css +++ b/src/styles/reset.css @@ -152,5 +152,10 @@ table { .anchorBL{display:none;} /*去掉百度地图logo*/ - +/*.BMap_Marker{*/ + /*z-index: 1!important;*/ +/*}*/ +/*.BMapLabel{*/ + /*z-index: 2!important;*/ +/*}*/ diff --git a/src/views/mapsection.vue b/src/views/mapsection.vue index 3066c03..839bde3 100644 --- a/src/views/mapsection.vue +++ b/src/views/mapsection.vue @@ -151,10 +151,12 @@ export default { var marker = new BMap.Marker(pt,{icon:myIcon}); } console.log(data) + marker.setTop(true,27000000); map.addOverlay(marker); var myLabel; - marker.addEventListener("mouseover", function (e) { + marker.addEventListener("mouseover", (e)=> { + var that = this; console.log(e) myLabel = new BMap.Label( `
@@ -177,10 +179,12 @@ export default { // whiteSpace: "normal", backgroundColor: "", border: "0px", - // zIndex: "1000" + zIndex: "1000" } ); - map.addOverlay(myLabel); + marker.setLabel(myLabel) + marker.setTop(true,27000000); + }); marker.addEventListener("mouseout", function (e) { -- libgit2 0.21.4