代码
const map = new BMap.Map('map', {
enableIconInfoWindow: true,
style: {
styleJson: styleLight,
},
});
map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);
map.addControl(new BMap.NavigationControl());
map.addControl(new BMap.ZoomControl());
var panel = new BMap.PlaceDetail(document.getElementById('panel'));
panel.render('06d2dffda107b0ef89f15db6');
function setDarkTheme() {
map.setMapStyle({styleJson: styleNight, merge: true});
map.setTheme('dark');
}
function setLightTheme() {
map.setMapStyle({styleJson: styleLight});
map.setTheme('light');
}
预览