42 lines
1.1 KiB
HTML
42 lines
1.1 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<html>
|
||
|
|
|
||
|
|
<head>
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
|
|
||
|
|
<script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
|
||
|
|
<script type="text/javascript"
|
||
|
|
src="https://api.map.baidu.com/api?v=3.0&&type=webgl&ak=cClgLBaLgGUdQDilX9dGvieL"></script>
|
||
|
|
|
||
|
|
<title>百度地图</title>
|
||
|
|
<style>
|
||
|
|
#map-container {
|
||
|
|
width: 100vw;
|
||
|
|
height: 100vh;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** 去除百度地图的水印和logo */
|
||
|
|
.BMap_cpyCtrl,
|
||
|
|
.anchorBL {
|
||
|
|
display: none;
|
||
|
|
}
|
||
|
|
</style>
|
||
|
|
</head>
|
||
|
|
|
||
|
|
<body>
|
||
|
|
<div id="map-container"></div>
|
||
|
|
</body>
|
||
|
|
|
||
|
|
<script type="text/javascript">
|
||
|
|
|
||
|
|
document.addEventListener('UniAppJSBridgeReady', function () {
|
||
|
|
const map = new BMapGL.Map('map-container') // 创建地图实例
|
||
|
|
let point = new BMapGL.Point(117.13805, 31.8734) // 创建点坐标
|
||
|
|
map.centerAndZoom(point, 12) // 初始化地图,设置中心点坐标和地图级别
|
||
|
|
map.enableScrollWheelZoom(true) // 启用滚轮放大缩小
|
||
|
|
})
|
||
|
|
|
||
|
|
</script>
|
||
|
|
|
||
|
|
</html>
|