项目作者: schlunsen

项目描述 :
Nuxt module for leafletjs - https://schlunsen.github.io/nuxt-leaflet/
高级语言: Vue
项目地址: git://github.com/schlunsen/nuxt-leaflet.git
创建时间: 2018-03-13T09:01:03Z
项目社区:https://github.com/schlunsen/nuxt-leaflet

开源协议:MIT License

下载


nuxt-leaflet

npm (scoped with tag)
npm
js-standard-style

Nuxt module for leafletjs

📖 Release Notes

Features

Nuxt module for vue2-leaflet.

See vue2-leaflet for more details.

Setup

  • Add nuxt-leaflet dependency using yarn or npm to your project
  • Add nuxt-leaflet to modules section of nuxt.config.js
  1. {
  2. modules: [
  3. // Simple usage
  4. 'nuxt-leaflet',
  5. // With options
  6. ['nuxt-leaflet', { /* module options */ }],
  7. ]
  8. }

Usage

Add the map to your page

  1. <div id="map-wrap" style="height: 100vh">
  2. <client-only>
  3. <l-map :zoom=13 :center="[55.9464418,8.1277591]">
  4. <l-tile-layer url="http://{s}.tile.osm.org/{z}/{x}/{y}.png"></l-tile-layer>
  5. <l-marker :lat-lng="[55.9464418,8.1277591]"></l-marker>
  6. </l-map>
  7. </client-only>
  8. </div>

The Leaflet ‘L’ object can be found on vue component: this.$L

Typescript

If you’re using TypeScript, you’ll need to add nuxt-leaflet in your compilerOptions of your tsconfig.json :

  1. {
  2. "compilerOptions": {
  3. "types": [
  4. "@types/node",
  5. "@nuxt/vue-app",
  6. "nuxt-leaflet"
  7. ]
  8. }
  9. }

You’ll then be able to have autocompletion in Vue instances (this.$L).

List of currently implemented components

See components supported

Development

  • Clone this repository
  • Install dependencies using yarn install or npm install
  • Start development server using npm run dev

License

MIT License

Copyright (c) Rasmus Schlunsen