var map = L.map("map", {
center: [26.6, 106.7],
zoom: 14,
layers: [L.tileLayer('http://cache1.arcgisonline.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer/tile/{z}/{y}/{x}'),],
});
center //地图中心经纬度
zoom //缩放级别
layers //图层背景
<div id="map"></div>
leaflet文档
leaflet.github
![](https://i-blog.csdnimg.cn/blog_migrate/2671986b5c7d3ea22ca3e33d213dc3ab.png)
完整代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>leaflet</title>
<link
href="https://cdn.bootcdn.net/ajax/libs/leaflet/1.6.0/leaflet.css"
rel="stylesheet"
/>
<style>
#map {
width: 500px;
height: 500px;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="https://cdn.bootcdn.net/ajax/libs/leaflet/1.6.0/leaflet.js"></script>
<script>
var map = L.map('map', {
center: [26.6, 106.7],
zoom: 14,
layers: [
L.tileLayer(
'http://cache1.arcgisonline.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer/tile/{z}/{y}/{x}'
),
],
});
</script>
</body>
</html>