Coder Social home page Coder Social logo

huang-hua1212 / vue2-leaflet-movingmarker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from louismazel/vue2-leaflet-movingmarker

0.0 0.0 0.0 2.97 MB

MovingMarker plugin extension for vue2-leaflet package

Home Page: https://louismazel.github.io/vue2-leaflet-movingmarker/

License: MIT License

Vue 76.65% JavaScript 23.35%

vue2-leaflet-movingmarker's Introduction

vue2-leaflet-movingmarker

This is a movingmarker plugin extension for vue2-leaflet package

Install

npm install --save vue2-leaflet-movingmarker

Demo

Enjoy here You can see the demo code in the file Map.vue

Usage

on <template> add

something like this

<l-map :zoom=10 :center="initialLocation">
  <l-tile-layer url="http://{s}.tile.osm.org/{z}/{x}/{y}.png" />
  <l-moving-marker
      v-for="driver in drivers"
      :key="driver.uuid"
      v-if="driver.location"
      :lat-lng="getLocation(driver)"
      :icon="getIcon(driver.uuid)"
      @click="setCurrentDriver(driver)"
      ref="driverMarker"
      :duration="2000"
  />
</l-map>

on <script> add

option 1

In the same template file, at <script> part, this will make the component available only to the template in this file

import LMovingMarker from 'vue2-leaflet-movingmarker'
...
export default {
  ...
  components: {
    LMovingMarker
    ...
  },
  ...
}

option 2

At main Vue configuration, this will make the component available to all templates in your app

import Vue from 'vue'
import LMovingMarker from 'vue2-leaflet-movingmarker'
...
Vue.component('l-moving-marker', LMovingMarker)

Access movingmarker layer directly

If you need to access other movingmarker methods, like slideTo(), you can do it with a ref on the movingmarker vue element and using the mapObject property

...
<l-moving-marker ref="movingMarkerRef">
  ...
</l-moving-marker>
...
...
this.$refs.movingMarkerRef.mapObject.slideTo()
...

Develop and build

npm install
npm run build

Author

Mazuel Loïc

License

MIT

vue2-leaflet-movingmarker's People

Contributors

louismazel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.