Nuxt Nation 会議が開催されます。11 月 12 日から 13 日の 2 日間に参加しよう。

leaflet
@nuxtjs/leaflet

Nuxt と Leaflet を統合

@nuxtjs/leaflet

Nuxt Leaflet

npm versionnpm downloadsLicenseNuxt

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="&amp;copy; <a href=&quot;https://www.openstreetmap.org/&quot;>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