{"_id":"@benj-6/tdt-map-vue3","_rev":"5-a3712122665aebde1130d10b8863b46e","name":"@benj-6/tdt-map-vue3","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"@benj-6/tdt-map-vue3","version":"1.0.0","keywords":["vue3","tianditu","element","map","skymap","tianmap","天地图","天地图组件"],"license":"MIT","_id":"@benj-6/tdt-map-vue3@1.0.0","maintainers":[{"name":"benj-6","email":"1103377580@qq.com"}],"homepage":"https://github.com/BenJ-6/tdt-map-vue3","bugs":{"url":"https://github.com/BenJ-6/tdt-map-vue3/issues"},"dist":{"shasum":"472afc88b3d3c787760f16b08ac3f965daa96c4a","tarball":"https://registry.npmjs.org/@benj-6/tdt-map-vue3/-/tdt-map-vue3-1.0.0.tgz","fileCount":526,"integrity":"sha512-FABphotACyjTXlb8wkv47G+B2640gu52zPwc3FEDT46rL9UA9WVzFOlSubTMOZeQDx5GabvhYyzG5PEywQCRSw==","signatures":[{"sig":"MEUCIQDxuB7XBbboUfTqyh21IHHEI2Nm9JohHXCnQ2DFB0s5kwIgSUXFB3HkzkJL9xka3qBVq6bFNd2ZjRZSbTTCQukccPY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":673373},"main":"dist/lib/index.js","type":"module","types":"dist/es/index.d.ts","module":"dist/es/index.mjs","gitHead":"e1b4a3e34bf3543ac147cdf24346db1ed0e631f4","scripts":{"dev":"vite","lint":"eslint . --fix","build":"run-p type-check build-only","format":"prettier --write .","prepare":"husky","preview":"vite preview","release":"node scripts/release.js","docs:dev":"run-s copy-docs docs:dev-no-copy","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s","copy-docs":"ncp README.md docs/index.md && ncp CHANGELOG.md docs/CHANGELOG.md","build-only":"vite build","docs:build":"run-s copy-docs docs:build-no-copy","type-check":"vue-tsc --build --force","docs:preview":"vitepress serve docs","prepublishOnly":"run-p build","docs:dev-no-copy":"vitepress dev docs","docs:build-no-copy":"vitepress build docs"},"_npmUser":{"name":"benj-6","email":"1103377580@qq.com"},"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git+https://github.com/BenJ-6/tdt-map-vue3.git","type":"git"},"_npmVersion":"11.17.0","description":"- 天地图 Vue 3 组件库","directories":{},"lint-staged":{"*.{ts,vue}":["prettier --write","eslint --fix"]},"_nodeVersion":"24.19.0","dependencies":{"mitt":"^3.0.1"},"_hasShrinkwrap":false,"devDependencies":{"ncp":"^2.0.0","vue":"^3.5.13","vite":"^6.2.0","execa":"^9.5.2","husky":"^9.1.7","eslint":"^9.21.0","vue-tsc":"^2.2.8","enquirer":"^2.4.1","prettier":"^3.5.3","vitepress":"^1.6.3","typescript":"~5.7.3","@types/node":"^22.13.9","lint-staged":"^15.4.3","npm-run-all2":"^7.0.2","@vue/tsconfig":"^0.7.0","sass-embedded":"^1.85.1","tianditu-types":"^1.0.1","@commitlint/cli":"^19.7.1","vite-plugin-dts":"^4.5.3","@tsconfig/node22":"^22.0.0","eslint-plugin-vue":"^10.0.0","@vitejs/plugin-vue":"^5.2.1","conventional-changelog-cli":"^5.0.0","@vue/eslint-config-prettier":"^10.2.0","@vue/eslint-config-typescript":"^14.5.0","@commitlint/config-conventional":"^19.7.1"},"peerDependencies":{"vue":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/tdt-map-vue3_1.0.0_1788925064370_0.9955783594270948","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@benj-6/tdt-map-vue3","version":"1.0.1","keywords":["vue3","tianditu","element","map","skymap","tianmap","天地图","天地图组件"],"license":"MIT","_id":"@benj-6/tdt-map-vue3@1.0.1","maintainers":[{"name":"benj-6","email":"1103377580@qq.com"}],"homepage":"https://github.com/BenJ-6/tdt-map-vue3","bugs":{"url":"https://github.com/BenJ-6/tdt-map-vue3/issues"},"dist":{"shasum":"672dbd1719c8b02657abd8bf10324b1448d3e54b","tarball":"https://registry.npmjs.org/@benj-6/tdt-map-vue3/-/tdt-map-vue3-1.0.1.tgz","fileCount":526,"integrity":"sha512-RPbMMVoTZZNEFl2FjtesGmlud9xyT7ogTQK2AaIM17/49S5wKF2WQBeEt+jTKF4w3wpmR8dryeeYqSuWqKrrRA==","signatures":[{"sig":"MEUCIG91MiwPRS9J0TOd8mKGf7Vpw9KtAQxTcO8TTUgYpHdCAiEA5i1nUUATjKAxF8T8U/GWNbH+c1vbQx2/l94DgnmOEa0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQCHwJyWl3BGuaGd5LwrTSLh8bi29WQex+CPgNDknn/QSAIhAIb196lrWlkQCkvBGqIJ99tCX2IYsSxDE5QkJvG0md+w","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":672770},"main":"dist/lib/index.js","type":"module","types":"dist/es/index.d.ts","module":"dist/es/index.mjs","gitHead":"fb4c6613405113fc1c004f1411be1a671f79a9d9","scripts":{"dev":"vite","lint":"eslint . --fix","build":"run-p type-check build-only","format":"prettier --write .","prepare":"husky","preview":"vite preview","release":"node scripts/release.js","docs:dev":"run-s copy-docs docs:dev-no-copy","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s","copy-docs":"ncp README.md docs/index.md && ncp CHANGELOG.md docs/CHANGELOG.md","build-only":"vite build","docs:build":"run-s copy-docs docs:build-no-copy","type-check":"vue-tsc --build --force","docs:preview":"vitepress serve docs","prepublishOnly":"run-p build","docs:dev-no-copy":"vitepress dev docs","docs:build-no-copy":"vitepress build docs"},"_npmUser":{"name":"benj-6","email":"1103377580@qq.com"},"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git+https://github.com/BenJ-6/tdt-map-vue3.git","type":"git"},"_npmVersion":"11.17.0","description":"- 天地图 Vue 3 组件库","directories":{},"lint-staged":{"*.{ts,vue}":["prettier --write","eslint --fix"]},"_nodeVersion":"24.19.0","dependencies":{"mitt":"^3.0.1","tianditu-types":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"ncp":"^2.0.0","vue":"^3.5.13","vite":"^6.2.0","execa":"^9.5.2","husky":"^9.1.7","eslint":"^9.21.0","vue-tsc":"^2.2.8","enquirer":"^2.4.1","prettier":"^3.5.3","vitepress":"^1.6.3","typescript":"~5.7.3","@types/node":"^22.13.9","lint-staged":"^15.4.3","npm-run-all2":"^7.0.2","@vue/tsconfig":"^0.7.0","sass-embedded":"^1.85.1","@commitlint/cli":"^19.7.1","vite-plugin-dts":"^4.5.3","@tsconfig/node22":"^22.0.0","eslint-plugin-vue":"^10.0.0","@vitejs/plugin-vue":"^5.2.1","conventional-changelog-cli":"^5.0.0","@vue/eslint-config-prettier":"^10.2.0","@vue/eslint-config-typescript":"^14.5.0","@commitlint/config-conventional":"^19.7.1"},"peerDependencies":{"vue":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/tdt-map-vue3_1.0.1_1788939279330_0.9171315487057068","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@benj-6/tdt-map-vue3","version":"1.0.2","keywords":["vue3","tianditu","element","map","skymap","tianmap","天地图","天地图组件"],"license":"MIT","_id":"@benj-6/tdt-map-vue3@1.0.2","maintainers":[{"name":"benj-6","email":"1103377580@qq.com"}],"homepage":"https://github.com/BenJ-6/tdt-map-vue3","bugs":{"url":"https://github.com/BenJ-6/tdt-map-vue3/issues"},"dist":{"shasum":"9c2d09417984f0c14bcf8796bdcdc78c7e9da25e","tarball":"https://registry.npmjs.org/@benj-6/tdt-map-vue3/-/tdt-map-vue3-1.0.2.tgz","fileCount":526,"integrity":"sha512-mCnzSq1nTHQpYSlvHbBiA2e8FiHl4x+5wBHO/c4C+qXUFwWY4Fj/Jz6Xt0Xfvd7xC5XLNHJ3g2wTMugi01oFXQ==","signatures":[{"sig":"MEUCIHVahUWoanqU/TqNcxK4mY5FG12aBbs13gf8WmuTah1QAiEAgQvrh4qwXntuYFn2RQCrZTCvPLKf7dR8xkc7sZNWq9A=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQCFvgFjb7CiiE8jK2v5L7YZaEWvCut1NAfsE+YKvgmSRwIgeBxoVn4dg12dbwn7ns7+RNP1/8qAZsJI6Lo0HQ1evdo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":672770},"main":"dist/lib/index.js","type":"module","types":"dist/es/index.d.ts","module":"dist/es/index.mjs","gitHead":"cb912d769aaea6265157a14401e3f4292bb7992a","scripts":{"dev":"vite","lint":"eslint . --fix","build":"run-p type-check build-only","format":"prettier --write .","prepare":"husky","preview":"vite preview","release":"node scripts/release.js","docs:dev":"run-s copy-docs docs:dev-no-copy","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s","copy-docs":"ncp README.md docs/index.md && ncp CHANGELOG.md docs/CHANGELOG.md","build-only":"vite build","docs:build":"run-s copy-docs docs:build-no-copy","type-check":"vue-tsc --build --force","docs:preview":"vitepress serve docs","prepublishOnly":"run-p build","docs:dev-no-copy":"vitepress dev docs","docs:build-no-copy":"vitepress build docs"},"_npmUser":{"name":"benj-6","email":"1103377580@qq.com"},"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git+https://github.com/BenJ-6/tdt-map-vue3.git","type":"git"},"_npmVersion":"11.17.0","description":"- 天地图 Vue 3 组件库","directories":{},"lint-staged":{"*.{ts,vue}":["prettier --write","eslint --fix"]},"_nodeVersion":"24.19.0","dependencies":{"mitt":"^3.0.1"},"_hasShrinkwrap":false,"devDependencies":{"ncp":"^2.0.0","vue":"^3.5.13","vite":"^6.2.0","execa":"^9.5.2","husky":"^9.1.7","eslint":"^9.21.0","vue-tsc":"^2.2.8","enquirer":"^2.4.1","prettier":"^3.5.3","vitepress":"^1.6.3","typescript":"~5.7.3","@types/node":"^22.13.9","lint-staged":"^15.4.3","npm-run-all2":"^7.0.2","@vue/tsconfig":"^0.7.0","sass-embedded":"^1.85.1","tianditu-types":"^1.0.1","@commitlint/cli":"^19.7.1","vite-plugin-dts":"^4.5.3","@tsconfig/node22":"^22.0.0","eslint-plugin-vue":"^10.0.0","@vitejs/plugin-vue":"^5.2.1","conventional-changelog-cli":"^5.0.0","@vue/eslint-config-prettier":"^10.2.0","@vue/eslint-config-typescript":"^14.5.0","@commitlint/config-conventional":"^19.7.1"},"peerDependencies":{"vue":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/tdt-map-vue3_1.0.2_1788940107844_0.14814273193539074","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@benj-6/tdt-map-vue3","version":"1.0.3","keywords":["vue3","tianditu","element","map","skymap","tianmap","天地图","天地图组件"],"license":"MIT","_id":"@benj-6/tdt-map-vue3@1.0.3","maintainers":[{"name":"benj-6","email":"1103377580@qq.com"}],"homepage":"https://github.com/BenJ-6/tdt-map-vue3","bugs":{"url":"https://github.com/BenJ-6/tdt-map-vue3/issues"},"dist":{"shasum":"4c27b831b9ba22805c2c79adb2d8ed2aea9632f1","tarball":"https://registry.npmjs.org/@benj-6/tdt-map-vue3/-/tdt-map-vue3-1.0.3.tgz","fileCount":526,"integrity":"sha512-pyn8CHFEEKbVqJ9i5n+4T8e+frPrXpDHB6QWwFNtCKBZ1rcWnI9iR/Q1Ucfd90UQwOXpNVJaxgDT0l+EnN7eTA==","signatures":[{"sig":"MEQCIBoebhGhCfhrMt61xcwWw8pncTyAqSxuDwKVSDk6l3LoAiBnVXWY+Hl+6yYwm316OQn83gbSOzfN7apRbIKRoRa7qQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIEIdvF5C2QKwHe09YrBW+/Z2cqbZu3U//9B6hRwO4P42AiEA82IRF8B8Tlqa3FGNb9ZPOBWMKPqEpOoQhDDfWf7Sp0Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":676384},"main":"dist/lib/index.js","type":"module","types":"dist/es/index.d.ts","module":"dist/es/index.mjs","gitHead":"c07c1e73018e02445fd8ce1c28fd1859edddeedb","scripts":{"dev":"vite","lint":"eslint . --fix","build":"run-p type-check build-only","format":"prettier --write .","prepare":"husky","preview":"vite preview","release":"node scripts/release.js","docs:dev":"run-s copy-docs docs:dev-no-copy","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s","copy-docs":"ncp README.md docs/index.md && ncp CHANGELOG.md docs/CHANGELOG.md","build-only":"vite build","docs:build":"run-s copy-docs docs:build-no-copy","type-check":"vue-tsc --build --force","docs:preview":"vitepress serve docs","prepublishOnly":"run-p build","docs:dev-no-copy":"vitepress dev docs","docs:build-no-copy":"vitepress build docs"},"_npmUser":{"name":"benj-6","email":"1103377580@qq.com"},"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git+https://github.com/BenJ-6/tdt-map-vue3.git","type":"git"},"_npmVersion":"11.17.0","description":"- 天地图 Vue 3 组件库","directories":{},"lint-staged":{"*.{ts,vue}":["prettier --write","eslint --fix"]},"_nodeVersion":"24.19.0","dependencies":{"mitt":"^3.0.1"},"_hasShrinkwrap":false,"devDependencies":{"ncp":"^2.0.0","vue":"^3.5.13","vite":"^6.2.0","execa":"^9.5.2","husky":"^9.1.7","eslint":"^9.21.0","vue-tsc":"^2.2.8","enquirer":"^2.4.1","prettier":"^3.5.3","vitepress":"^1.6.3","typescript":"~5.7.3","@types/node":"^22.13.9","lint-staged":"^15.4.3","npm-run-all2":"^7.0.2","@vue/tsconfig":"^0.7.0","sass-embedded":"^1.85.1","tianditu-types":"^1.0.1","@commitlint/cli":"^19.7.1","vite-plugin-dts":"^4.5.3","@tsconfig/node22":"^22.0.0","eslint-plugin-vue":"^10.0.0","@vitejs/plugin-vue":"^5.2.1","conventional-changelog-cli":"^5.0.0","@vue/eslint-config-prettier":"^10.2.0","@vue/eslint-config-typescript":"^14.5.0","@commitlint/config-conventional":"^19.7.1"},"peerDependencies":{"vue":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/tdt-map-vue3_1.0.3_1789113154773_0.9847685368577899","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"_id":"@benj-6/tdt-map-vue3@1.0.4","bugs":{"url":"https://github.com/BenJ-6/tdt-map-vue3/issues"},"dist":{"shasum":"666d1a7f9c1f4f30625bde6dbd2597b83b513a89","tarball":"https://registry.npmjs.org/@benj-6/tdt-map-vue3/-/tdt-map-vue3-1.0.4.tgz","fileCount":526,"integrity":"sha512-qJas3CH8EfvwjLyqQJDlrrfZZ+N6Wyl1utJhollO1kd84/EkqDE3kuWUfj9ZzByUxOsRWUyxbqS3kgpsN7+A4g==","signatures":[{"sig":"MEYCIQCzMwc30NEYnHkcnoZ+1PdlSOlmtUGudsM1+Xqui5P3MgIhAMTRBfTmMO+HhggNcK0fMDSduj1r34a1y1ZuOmQAyhMF","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCrqxYYyanQ0mTyz0qgW/1hfdp/qeHDX4qw8DWZNzaZ7gIhAJm3jX6jc9wcHmbjweaUhG+Es+EF6r+Fr38YltBkowoJ"}],"unpackedSize":677888},"main":"dist/lib/index.js","name":"@benj-6/tdt-map-vue3","type":"module","types":"dist/es/index.d.ts","module":"dist/es/index.mjs","gitHead":"cacd408cfbd360262f83f8a481b18d3af197728a","license":"MIT","scripts":{"dev":"vite","lint":"eslint . --fix","build":"run-p type-check build-only","format":"prettier --write .","prepare":"husky","preview":"vite preview","release":"node scripts/release.js","docs:dev":"run-s copy-docs docs:dev-no-copy","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s","copy-docs":"ncp README.md docs/index.md && ncp CHANGELOG.md docs/CHANGELOG.md","build-only":"vite build","docs:build":"run-s copy-docs docs:build-no-copy","type-check":"vue-tsc --build --force","docs:preview":"vitepress serve docs","prepublishOnly":"run-p build","docs:dev-no-copy":"vitepress dev docs","docs:build-no-copy":"vitepress build docs"},"version":"1.0.4","_npmUser":{"name":"benj-6","email":"1103377580@qq.com"},"homepage":"https://github.com/BenJ-6/tdt-map-vue3","keywords":["vue3","tianditu","element","map","skymap","tianmap","天地图","天地图组件"],"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git+https://github.com/BenJ-6/tdt-map-vue3.git","type":"git"},"_npmVersion":"11.19.0","description":"- 天地图 Vue 3 组件库","directories":{},"lint-staged":{"*.{ts,vue}":["prettier --write","eslint --fix"]},"maintainers":[{"name":"benj-6","email":"1103377580@qq.com"}],"_nodeVersion":"24.21.0","dependencies":{"mitt":"^3.0.1"},"_hasShrinkwrap":false,"devDependencies":{"ncp":"^2.0.0","vue":"^3.5.13","vite":"^6.2.0","execa":"^9.5.2","husky":"^9.1.7","eslint":"^9.21.0","vue-tsc":"^2.2.8","enquirer":"^2.4.1","prettier":"^3.5.3","vitepress":"^1.6.3","typescript":"~5.7.3","@types/node":"^22.13.9","lint-staged":"^15.4.3","npm-run-all2":"^7.0.2","@vue/tsconfig":"^0.7.0","sass-embedded":"^1.85.1","tianditu-types":"^1.0.1","@commitlint/cli":"^19.7.1","vite-plugin-dts":"^4.5.3","@tsconfig/node22":"^22.0.0","eslint-plugin-vue":"^10.0.0","@vitejs/plugin-vue":"^5.2.1","conventional-changelog-cli":"^5.0.0","@vue/eslint-config-prettier":"^10.2.0","@vue/eslint-config-typescript":"^14.5.0","@commitlint/config-conventional":"^19.7.1"},"peerDependencies":{"vue":"^3.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tdt-map-vue3_1.0.4_1789627892660_0.9117701429163021"}}},"time":{"created":"2026-09-09T03:37:44.145Z","modified":"2026-09-17T06:51:32.923Z","1.0.0":"2026-09-09T03:37:44.511Z","1.0.1":"2026-09-09T07:34:39.479Z","1.0.2":"2026-09-09T07:48:27.959Z","1.0.3":"2026-09-11T07:52:34.871Z","1.0.4":"2026-09-17T06:51:32.756Z"},"bugs":{"url":"https://github.com/BenJ-6/tdt-map-vue3/issues"},"license":"MIT","homepage":"https://github.com/BenJ-6/tdt-map-vue3","keywords":["vue3","tianditu","element","map","skymap","tianmap","天地图","天地图组件"],"repository":{"url":"git+https://github.com/BenJ-6/tdt-map-vue3.git","type":"git"},"description":"- 天地图 Vue 3 组件库","maintainers":[{"name":"benj-6","email":"1103377580@qq.com"}],"readme":"# tdt-map-vue3\n\n- 天地图 Vue 3 组件库\n\n- [tdt-map-vue3 文档](https://18673107372.github.io/tdt-map-vue3/)\n\n## 项目状态\n\n本项目已弃用，不再继续维护。\n\n个人在实际使用中认为这层 Vue 组件封装收益有限，更推荐直接引入天地图官方 JS API 来使用，方式更直接、排查问题也更方便。\n\n## 推荐用法（直接加载官方 JS）\n\n```ts\n/**\n * 按需加载天地图官方 JS API v4.0 脚本。\n * 官方接入方式：<script src=\"https://api.tianditu.gov.cn/api?v=4.0&tk=密钥\"></script>，\n * 脚本加载后在全局注入 T 命名空间（new T.Map / T.LngLat 等）。\n * 模块级缓存：整个应用只加载一次，多个地图实例共享。\n */\n\nconst SCRIPT_URL = `https://api.tianditu.gov.cn/api?v=4.0&tk=${import.meta.env.VITE_TDT_TK}`;\n\nlet loadPromise: Promise<void> | null = null;\n\n/** 确保官方脚本已加载；重复调用（含并发）只发起一次真实请求 */\nexport function loadTdtScript(): Promise<void> {\n  if (window.T) return Promise.resolve();\n  if (!loadPromise) {\n    loadPromise = new Promise((resolve, reject) => {\n      const script = document.createElement(\"script\");\n      script.src = SCRIPT_URL;\n      script.type = \"text/javascript\";\n      script.async = true;\n      script.defer = true;\n      script.onload = () => resolve();\n      script.onerror = () => {\n        // 加载失败后允许下次进入地图页面时重新尝试\n        loadPromise = null;\n        reject(new Error(\"天地图 JS API 加载失败\"));\n      };\n      document.body.appendChild(script);\n    });\n  }\n  return loadPromise;\n}\n```\n\n## 说明\n\nfork自 [tdt-map-vue3](https://github.com/18673107372/tdt-map-vue3)\n\n## 安装\n\n```sh\nnpm i tdt-map-vue3\n# or\nyarn add tdt-map-vue3\n```\n\n## 快速上手\n\n### 全局引入\n\n全部引入，解放双手\n\n```ts\n// main.ts\nimport { createApp } from \"vue\";\nimport App from \"./App.vue\";\nimport { install } from \"tdt-map-vue3\";\n\nconst app = createApp(App);\napp.use(install, {\n  v: \"4.0\", //目前只支持4.0版本\n  tk: \"your map token\",\n  plugins: ['D3', 'CarTrack'],  //需要加载的插件\n  plugDomain: '' //使用自定义加载插件的域名，官方发布的插件js（未压缩）会出现https强转为http的问题，可以变相使用代理解决问题\n});\napp.mount(\"#app\");\n```\n\n```html\n<!-- App.vue -->\n<template>\n  <div class=\"mapDiv\">\n    <tdt-map :center=\"state.center\" :zoom=\"state.zoom\"></tdt-map>\n  </div>\n</template>\n\n<script lang=\"ts\" setup>\n  import { reactive } from \"vue\";\n  import type { LngLat } from \"tdt-map-vue3\";\n\n  const state = reactive({\n    center: [113.280637, 23.125178]  as LngLat,\n    zoom: 12\n  });\n</script>\n\n<style>\n  .mapDiv {\n    width: 100%;\n    height: 100%;\n  }\n</style>\n```\n\n### 按需引入\n\n按需引入，配合 ts 获得类型提示。\n\n- 使用组件时传入接口参数\n\n**`loadConfig`仅第一次生效，后续调用忽略此参数。**\n\n\n```html\n<!--App.vue-->\n<template>\n  <div class=\"mapDiv\">\n    <tdt-map :center=\"state.center\" :zoom=\"state.zoom\" :loadConfig=\"loadConfig\"></tdt-map>\n  </div>\n</template>\n\n<script lang=\"ts\" setup>\n  import { reactive } from \"vue\";\n  import { TdtMap, type LngLat } from \"tdt-map-vue3\";\n\n  const loadConfig = { v: \"4.0\", tk: \"your map token\" };\n  const state = reactive({\n    center: [113.280637, 23.125178] as LngLat,\n    zoom: 12\n  });\n</script>\n\n<style>\n  .mapDiv {\n    width: 100%;\n    height: 100%;\n  }\n</style>\n```\n\n- 单独调用`useApiLoader`\n\n```ts\n// main.ts\nimport { createApp } from \"vue\";\nimport App from \"./App.vue\";\nimport { useApiLoader } from \"tdt-map-vue3\";\n\nconst app = createApp(App);\nuseApiLoader( {\n  v: \"4.0\", //目前只支持4.0版本\n  tk: \"your map token\"\n});\napp.mount(\"#app\");\n```\n\n```html\n<!--App.vue-->\n<template>\n  <div class=\"mapDiv\">\n    <tdt-map :center=\"state.center\" :zoom=\"state.zoom\"></tdt-map>\n  </div>\n</template>\n\n<script lang=\"ts\" setup>\n  import { reactive } from \"vue\";\n  import { TdtMap, type LngLat } from \"tdt-map-vue3\";\n\n  const state = reactive({\n    center: [113.280637, 23.125178] as LngLat,\n    zoom: 12\n  });\n</script>\n\n<style>\n  .mapDiv {\n    width: 100%;\n    height: 100%;\n  }\n</style>\n```\n\n### API 加载器\n\n甚至可以把它当作无情的 API 加载工具\n\n```ts\nimport { useApiLoader } from \"tdt-map-vue3\";\n\nuseApiLoader({\n  v: \"4.0\",\n  tk: \"your map token\",\n  plugins: [\"D3\", \"CarTrack\", \"HeatmapOverlay\", \"BufferTool\", \"ImageOverLayer\"]\n}).then(() => {\n  new T.Map({ ... });\n});\n```\n\n## 辅助函数\n\n```ts\nimport { toLngLat, toBounds, toPoint, toIcon } from \"tdt-map-vue3\";\n```\n\n### 说明\n\n| 函数名                                                | 返回值      | 描述                                                                                                                                            |\n|----------------------------------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| toLngLat(lnglat:[number,number])                   | T.LngLat | 转换为经纬度对象。<br>参数说明:<br>lnglat:经纬度数组                                                                                                            |\n| toBounds(bounds:[[number,number],[number,number]]) | T.Bounds | 转换为地理范围对象。<br>参数说明:<br>bounds:地理范围数组                                                                                                          |\n| toPoint(point:[number,number])                     | T.Point  | 转换为像素坐标点对象。<br>参数说明:<br>point:像素坐标点数组                                                                                                         |\n| toIcon(icon:IconOption\\|string)                    | T.Icon   | 转换为图标对象。<br>参数说明:<br>`icon:string//图片地址` 或 `{iconUrl:string,//图片地址`<br>`iconSize:[number,number],//图片大小`<br>`iconAnchor:[number,number]//偏移}` |\n\n## 调用原生API\n\n由于API是通过`useApiLoader`异步加载的，所以需要在API加载完成后才能使用天地图原生的API，有以下三种方式:\n\n- 不使用组件，只使用API加载器\n\n```html\n\n<template>\n  <div id=\"mapContainer\"></div>\n</template>\n\n<script>\n  import { useApiLoader } from \"tdt-map-vue3\";\n  // 加载API\n  useApiLoader({\n    v: \"4.0\",\n    tk: \"your map token\",\n    plugins: [\"D3\", \"CarTrack\", \"HeatmapOverlay\", \"BufferTool\", \"ImageOverLayer\"]\n  }).then(() => {\n    const map = new T.Map(\"mapContainer\", { ... });\n    const marker = new T.Marker({ ... });\n    map.addOverLay(marker);\n  });\n</script>\n```\n\n- 使用组件，监听组件的初始化事件\n\n```html\n\n<template>\n  <tdt-map @init=\"mapInit\"></tdt-map>\n</template>\n\n<script>\n  function mapInit(map) {\n    // 此时原生API中的T已存在window中\n    const marker = new T.Marker({ ... })\n    map.addOverLay(marker);\n  }\n</script>\n```\n\n- 注册了组件，使用API加载器异步等待API加载完成\n\n```js\n// 不用传参数，异步等待之前注册组件时带参数加载的API加载完成\nuseApiLoader({}).then(() => {\n  const marker = new T.Marker({ ... });\n});\n```\n","readmeFilename":"README.md"}