Closed pablocattaneo closed 4 years ago
any new about this ? thanks !
Hi @nelsonlarocca I solved the problem in that way:
1- I created a plugin in the plugins directory I named it vue2-leaflet-markercluster.js. The code:
import Vue from "vue";
import * as L from "leaflet";
import Vue2LeafletMarkerCluster from "vue2-leaflet-markercluster";
Vue.component("v-marker-cluster", Vue2LeafletMarkerCluster);
const LeafletPlugin = {
install(Vue) {
// Expose Leaflet
Vue.prototype.$L = L;
}
};
Vue.use(LeafletPlugin);
2- I added plugin in /nuxt.config.js
Hope it can help you.
Thanks Pablo, it worked out !!!
Great @nelsonlarocca !! Glad to hear that!!
Awesome! Should close this issue? @pablocattaneo
Closing issue. Thanks @pablocattaneo. Also as an alternative, try upgrading to latest version, it works very differently on exposing the global.L variable
Awesome! Should close this issue? @pablocattaneo
Yes @dpr989 you can close it!
Using nuxt-leaflet module I can set an use alot of the component list: https://github.com/schlunsen/nuxt-leaflet/blob/master/lib/templates/plugin.js like l-marker, l-map, l-tile-layer, but my project also require to use https://github.com/jperelli/vue2-leaflet-markercluster
What is the correct way to implement it in Nuxt?
I try this:
Create a plugins: vue2-leaflet-markercluster.js
Then set it in nuxt.config.js
and implemented in a page:
The output:
It look great, the problem happens when I click over a cluster it give me this error: