// utils/loadTMap.js
export async function loadTMap(tk) {
  if (window.T) return // 如果已加载，直接返回
  return new Promise((resolve, reject) => {
    const script = document.createElement('script')
    script.src = `https://api.tianditu.gov.cn/api?v=4.0&tk=${tk}`
    script.onload = () => resolve(window.T)
    script.onerror = (err) => reject(err)
    document.head.appendChild(script)
  })
}
