Raruto / leaflet-elevation

Leaflet plugin that allows to add elevation profiles using d3js
GNU General Public License v3.0
254 stars 84 forks source link

How can I import the leaflet-elevation. js file offline in a Vue project #293

Open InstantWindy opened 2 months ago

InstantWindy commented 2 months ago

Hi!I want to use the L.control. elevation function in the Vue project by introducing the eaflet-elevation. js file. Here is my citation method

2

But I found that the following errors may occur. 1

Does it still need to import files like distance.js ?

Raruto commented 2 months ago

Hi @InstantWindy,

I found that the following errors may occur. 1

Be aware, It looks like you are trying to develop without http server (ie. I don't know how much this mode is supported).

Does it still need to import files like distance.js ?

Yes, otherwise you just need a L.Control.Elevation.Speed (and the others/used handlers) within the global scope:

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/control.js#L750-L764

Here's a fairly complete example:

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/examples/leaflet-elevation_extended-ui.html#L42-L221

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/examples/leaflet-elevation_extended-ui.html#L253-L271

👋 Raruto