Nuxt Leaflet
Leaflet を使用する Nuxt モジュールです。Vue Leaflet を使用して作成されました。Vue Leaflet は Leaflet の Vue 3 ラッパーで、Vue コンポーネントとして元の Leaflet API を公開しています。
このモジュールは、特に何も構成せずに Nuxt と連携させることを目的にしています。
機能
- ⚡ 構成が不要
- 🦺 Typescript サポート
- 🚠 自動インポート
クイックセットアップ
npx nuxi@latest module add @nuxtjs/leaflet
以上です!これで Nuxt アプリケーションで Leaflet が使用できるようになりました ✨。
使用方法
使用可能なコンポーネントの完全なリストについては、公式ドキュメント ライブラリをご覧ください。
基本
<template>
<div style="height:100vh; width:100vw">
<LMap
ref="map"
:zoom="zoom"
:center="[47.21322, -1.559482]"
:use-global-leaflet="false"
>
<LTileLayer
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
attribution="&copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors"
layer-type="base"
name="OpenStreetMap"
/>
</LMap>
</div>
</template>
<script setup>
import { ref } from 'vue'
const zoom = ref(6)
</script>
開発
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Run Vitest
npm run test
npm run test:watch
# Release new version
npm run release