This is a polyline decorator plugin extension for vue2-leaflet package
npm install --save vue2-leaflet-polylinedecorator
git clone git@github.com:jperelli/vue2-leaflet-polylinedecorator.git
cd vue2-leaflet-polylinedecorator
yarn
yarn example
# or alternatively using npm
npm install
npm run example
Then you should be able to navigate with your browser and see the demo in http://localhost:4000/
You can see the demo code in the file example.vue
something like this
<v-map :zoom=10 :center="initialLocation">
<v-tilelayer url="http://{s}.tile.osm.org/{z}/{x}/{y}.png"></v-tilelayer>
<v-polyline-decorator :paths="[latlngsarray, otherlatlngsarray]" :options="options"></v-polyline-decorator>
<v-polyline :opacity="0" :latLngs="latlngsarray"></v-polyline>
</v-map>
In the same template file, at <script>
part, this will make the component available only to the template in this file
import Vue2LeafletPolylineDecorator from 'vue2-leaflet-polylinedecorator'
...
export default {
...
components: {
'v-polyline-decorator': Vue2LeafletPolylineDecorator
...
},
...
}
At main Vue configuration, this will make the component available to all templates in your app
import Vue from 'vue'
import Vue2LeafletPolylineDecorator from 'vue2-leaflet-polylinedecorator'
...
Vue.component('v-polyline-decorator', Vue2LeafletPolylineDecorator)
If you need to access other polylineDecorator methods, like setPaths(), you can do it with a ref on the polylinedecorator vue element and using the mapObject
property
...
<v-polyline-decorator ref="decoratorRef"></v-polyline-decorator>
...
...
this.$refs.decoratorRef.mapObject.setPaths()
...
npm install
npm run build
MIT