如何使用 在谷歌地图标签的文本:

问题描述 投票:1回答:1

我如何能在谷歌地图标签的文本使用br。我试图使用如下。但是没有制定出。任何特定的方式来使用它? ??

var marker = new google.maps.Marker({
    map: this.map,
    icon: 'img/background.png',
    label: {
        text: "name: " + String(account.name) + "\ncity :" + String(account.city),
        color: "#fff",
    },
    position: {
        lat: parseFloat(account.lat),
        lng: parseFloat(account.lng)
    }
});
javascript google-maps
1个回答
1
投票

使用\n,像这样

var marker = new google.maps.Marker({
   position: myLatLng,
   map: map,
   title: 'Hello\nWorld!'
});

你可以阅读更多关于谷歌地图标记这里Simple Markers

© www.soinside.com 2019 - 2024. All rights reserved.