From 1179eb82d8f0d28957a8d5ccd3a0ab7e3c5334b6 Mon Sep 17 00:00:00 2001 From: liuqimichale <123456lq> Date: Fri, 14 Dec 2018 09:45:40 +0800 Subject: [PATCH] 地图覆盖物 --- src/styles/reset.css | 19 +++++++++++++++++-- src/views/mapsection.vue | 25 +++++++++++++++---------- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/styles/reset.css b/src/styles/reset.css index 9d6768d..ada771f 100644 --- a/src/styles/reset.css +++ b/src/styles/reset.css @@ -109,7 +109,22 @@ table { position: absolute; } -.parkpop-content{ - color: #f00; +.dislog-wrap{ + width:84px; + height: 47px; + border-radius:2px; +} +.dialog-header{ + width: 84px; + height:14px; + line-height: 14px; + font-size: 12px; + font-weight:400; + text-align: center; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + color:rgba(255,255,255,1); + background:rgba(68,182,255,.6); } diff --git a/src/views/mapsection.vue b/src/views/mapsection.vue index 0819688..916d1f8 100644 --- a/src/views/mapsection.vue +++ b/src/views/mapsection.vue @@ -90,9 +90,9 @@ export default { }) let data = { nurseryInfo: [ - {MapPointX:'111.742579',MapPointY:'40.818675',status:0}, - {MapPointX:'111.722579',MapPointY:'40.878675',status:1}, - {MapPointX:'111.782579',MapPointY:'40.818675',status:2} + {Name:'万达停车场1',MapPointX:'111.742579',MapPointY:'40.818675',status:0}, + {Name:'万达停车场2',MapPointX:'111.722579',MapPointY:'40.878675',status:1}, + {Name:'万达停车场333333',MapPointX:'111.782579',MapPointY:'40.818675',status:2} ] } this.baiduMap(data) @@ -105,7 +105,7 @@ export default { nurseryInfo: [ {Name:'万达停车场1',MapPointX:'111.742579',MapPointY:'40.818675',status:2}, {Name:'万达停车场2',MapPointX:'111.722579',MapPointY:'40.878675',status:0}, - {Name:'万达停车场3',MapPointX:'111.782579',MapPointY:'40.818675',status:1} + {Name:'万达停车场333333',MapPointX:'111.782579',MapPointY:'40.818675',status:1} ] } this.baiduMap(data) @@ -147,24 +147,29 @@ export default { }); var marker = new BMap.Marker(pt,{icon:myIcon}); } - + console.log(data) map.addOverlay(marker); var myLabel; marker.addEventListener("mouseover", function (e) { + console.log(e) myLabel = new BMap.Label( - '
12321312
', + `
+
${data.nurseryInfo[item].Name}
+ +
`, { offset: new BMap.Size(30, -85), //label的偏移量,为了让label的中心显示在点上 - position: point + position: pt }); myLabel.setStyle({ // color: "#0f0", - fontSize: "12px", - // padding: "5px", + // fontSize: "12px", + padding: "0px", // whiteSpace: "normal", // backgroundColor: "#f00", - // border: "0px", + border: "0px", // zIndex: "1000" } ); -- libgit2 0.21.4