nuxt-modules/leaflet · 文件 下载 ZIP
文件最后提交记录最后更新时间
README.md
以下内容由 AI 翻译,如有问题请点此提交 issue 反馈
Nuxt Leaflet
一个用于在 Nuxt 中使用 Leaflet 的模块。 它基于 Vue Leaflet] 开发,后者是 Leaflet 的 Vue 3 封装版本,能够将原始的 Leaflet API 以 Vue 组件的形式呈现。
该模块的主要作用就是让其在无需任何配置的情况下与 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 Vitest
npm run test
npm run test:watch
# Release new version
npm run release
