nginx瓦片代理缓存

This commit is contained in:
龙澳
2026-03-31 15:56:51 +08:00
parent 806c16412a
commit 2e8b9cd83f
7 changed files with 76 additions and 65 deletions

View File

@@ -104,6 +104,9 @@ import { ref, computed, onMounted, watch } from 'vue'
import L from 'leaflet'
import 'leaflet/dist/leaflet.css'
// 瓦片代理地址 — 部署到内网其他机器时,将 localhost 改为服务器 IP
const TILE_PROXY_URL = 'http://localhost:8080/tiles/{z}/{x}/{y}{r}.png'
// ── 常量 ────────────────────────────────────────────────────
const TOTAL_VOLS = 63
@@ -268,9 +271,8 @@ function initMap() {
attributionControl: false
})
L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png', {
maxZoom: 18,
subdomains: 'abcd'
L.tileLayer(TILE_PROXY_URL, {
maxZoom: 18
}).addTo(map)
L.control.attribution({ prefix: false, position: 'bottomright' })