vue2-leaflet-polylinedecorator
v2.0.1
Published
polylinedecorator plugin extension for vue2-leaflet package
Downloads
262
Maintainers
Readme
vue2-leaflet-polylinedecorator
This is a polyline decorator plugin extension for vue2-leaflet package
Install
npm install --save vue2-leaflet-polylinedecorator
Demo
git clone [email protected]: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
Usage
on <template> add
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>
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 Vue2LeafletPolylineDecorator from 'vue2-leaflet-polylinedecorator'
...
export default {
...
components: {
'v-polyline-decorator': Vue2LeafletPolylineDecorator
...
},
...
}
option 2
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)
Access polylinedecorator layer directly
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()
...
Develop and build
npm install
npm run build
Author
License
MIT