diff --git a/src/views/index.vue b/src/views/index.vue index 507fe15..f8a3dda 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -60,7 +60,7 @@ export default { // 添加label在标点下方并居中 const label = new BMapGL.Label(item.proName, { position: point, - offset: new BMapGL.Size(-60, 10), // 调整偏移量,使文字在marker正下方 + offset: new BMapGL.Size(0, 0), // 调整偏移量,使文字在marker正下方 }) // 设置label样式 label.setStyle({ @@ -71,6 +71,7 @@ export default { padding: '5px', whiteSpace: 'nowrap', // 防止文字换行 fontSize: '18px', + transform: 'translateX(-45%)', }) this.map.addOverlay(label)