JSFiddle - React, Tailwind, and code Playground
by liyuanqiu
HTML
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=4WTdYMC6XKhfCrdRh5pgvHGz"></script>
<title>地图展示</title>
</head>
<body>
<div id="allmap"></div>
</body>
</html>
CSS
body, html, #allmap {
width: 100%;
height: 100%;
overflow: hidden;
margin: 0;
font-family: "微软雅黑";
}
JavaScript
'use strict';
const map = new BMap.Map("allmap");
map.addControl(new BMap.MapTypeControl({
mapTypes:[
BMAP_NORMAL_MAP,
BMAP_HYBRID_MAP,
],
}));
map.setMaxZoom(100);
map.enableScrollWheelZoom(true);
// 121.360493,31.228149
// 0.0937243 纬度
// 0.150857301 经度
const gpggaList =...