@nuxt-modules/map
v0.1.0
Published
Map module for Nuxt
Downloads
1
Maintainers
Readme
@nuxtjs/map
Map module for Nuxt
Features
- Nuxt 3 ready
- Easy integration with Google Maps & Leaflet
- Use only two components
nuxt-map
andnuxt-marker
no matter what map provider you choose - [Coming soon] More map providers and components
- TypeScript support
Setup
yarn add @nuxtjs/map # yarn
npm i @nuxtjs/map # npm
Basic usage
Firstly, you need to add @nuxtjs/map
to your Nuxt config.
// nuxt.config.js
{
buildModules: [
"@nuxtjs/map",
],
map: {
provider: '<YOUR_MAP_PROVIDER>' // google | leaflet
}
}
Then you can start using @nuxtjs/map
in your app!
<template>
<div>
<nuxt-map :options="{ center, zoom }" style="height: 500px">
<nuxt-marker
v-for="(marker, i) in markerPositions"
:key="i"
:options="{ position: marker }"
/>
</nuxt-map>
</div>
</template>
<script lang="ts" setup>
const markerPositions = [
{ lat: 40.689247, lng: -74.044502 },
{ lat: 40.689947, lng: -74.044502 },
{ lat: 40.684947, lng: -74.044502 }
]
const center = markerPositions[0]
const zoom = 15
</script>
Development
- Clone this repository
- Install dependencies using
yarn install
ornpm install
- Start development server using
yarn dev
ornpm run dev