Kingwaytek

安裝與初始化

安裝 mapPlus 到你的專案,開始開發地圖

安裝與初始化

可使用 npm 安裝 @kwmap/mapplus(建議),或是使用 CDN 標籤引入。

安裝完後,於註冊頁面取得專屬的 Key 和 Token 後,即可開始建立地圖。

使用 CDN 引入

於頁面 <head/> 標籤中引入 mapPlus

快速開始:

使用 npm 安裝

在終端機中執行以下指令安裝 @kwmap/mapplus


使用原生 JavaScript 開發

index.html:

於 html 中引入建立地圖容器。

main.js:

建立 main.js,並引入 mapPlus,即可開始使用地圖。


使用 React 開發

※注意: 需使用 React v17.0.0 以上版本。

main.jsx:

main.jsx 使用 <MapProvider> 包裹 useMap()<MapComponent> 作用域。

components/Map.jsx:

建立 components/Map.jsx,並引入 <MapComponent>useMap(),即可開始使用地圖。


使用 Vue 開發

※注意: 需使用 Vue v3.0.0 以上版本。

components/Map.vue:

建立 components/Map.vue,並引入 <MapComponent>useMap(),即可開始使用地圖。


使用 Vite 打包

※注意: 需使用 npm 安裝 @kwmap/mapplus

vite.config.js 中引入 viteMapPlusPlugin()