地图组件marker的使用问题
发布于 5 年前 作者 zdong 8176 次浏览 来自 问答

地图组件的marker的label为什么不能居中呢, 点击地图上的图标,callout 也没法弹出

markers: [{

id: 1,

latitude: 23.099994,

longitude: 113.324520,

name: ‘T.I.T 创意园’,

callout:{

content:“将大幅降价”

},

label: {

content: “将大幅降价”,

textAlign:“center”

}

}],

5 回复

同问, 怎么居中

我现在要在 marker 上显示数字,我现在通过判断几位数来动态设置左移多少像素。很蠢,但目前感觉没什么其他好的办法。

就是你们例子里的

wechatide://minicode/3uVxpmmT6wY9

我把markers里的数据改成这样的

markers: [{

id: 1,

latitude: 23.099994,

longitude: 113.324520,

title: ‘T.I.T 创意园’,

callout:{

content:“calloutcallout”,

display: “ALWAYS”,

textAlign: “center”,

bgColor: “#fff”,

padding: 10,

},

label: {

content: “label”,

textAlign:“center”,

bgColor:"#fff",

padding:10,

//   anchorX: -10, anchorY: -10,

//   x: -10, y: -30,

}

}],

显示成这个样子

同问,label怎么居中?或者可不可以添加一个map 属性,让一些文字内容在maker正下居中位置

回到顶部