For Tailwind CSS v3 docs, click here.

世界地图

显示可定制的世界地图,具有动画弧线和地理点的脉冲效果。

API

Prop 名称类型默认值描述
dotsArray<{ start: { lat: number; lng: number; label?: string }, end: { lat: number; lng: number; label?: string } }> []Array of dot objects, each containing a start and end coordinate (latitude, longitude).
classstring""Additional CSS classes for custom styling.
lineColorstring"#0EA5E9"Color of the arcs and dot borders.
mapColorstringMain color of the dotted map. (Required)
mapBgColorstringBackground color of the map. (Required)

通过 CLI 安装

npm
pnpm
bun
yarn
npx shadcn-vue@latest add "https://registry.inspira-ui.com/world-map.json"

手动安装

Install the dependencies

npm
pnpm
bun
yarn
npm install dotted-map

Component Code

You can 复制并粘贴以下代码: to create this component:

WorldMap.vue

功能特性

  • Animated Arcs: Smooth arcs between two geographical points using an SVG path.
  • Dotted Background: Renders a dotted map using the DottedMap library.
  • Pulsing Markers: Each point animates with expanding circles to highlight the location.
  • Dynamic Projection: Projects latitude/longitude to an 800x400 coordinate plane.
  • Customizable Colors: Control lineColor, mapColor, and mapBgColor.

感谢