项目需求要把地图做成符合页面整体UI的样式,效果图如下:
话不多说贴代码
// 自定义主题
map.setMapStyle({
styleJson: [
{
featureType: "water",
elementType: "all",
stylers: {
color: "#102d68",
},
},
{
featureType: "land",
elementType: "all",
stylers: {
color: "#091934",
},
},
{
featureType: "boundary",
elementType: "geometry",
stylers: {
color: "#064f85",
},
},
{
featureType: "railway",
elementType: "all",
stylers: {
visibility: "off",
},
},
{
featureType: "highway",
elementType: "geometry",
stylers: {
color: "#004981",
},
},
{
featureType: "highway&