There is a sample Vue 2 project available at this GitHub repository
I am looking to integrate an SVG into a leaflet divIcon.
const cloudIcon = L.divIcon({
html: thecloud, // this.cloudSvg, // thecloud,
className: 'my-custom-icons',
iconSize: [size, size],
iconAnchor: [size/2, size/2]
})
In addition, I may need to make some modifications to the SVG, so having the actual SVG source is necessary.
I found that placing the SVG inside of a javascript file and importing it using:
import {thecloud} from './TheCloud';
yields the desired result:
https://i.sstatic.net/Ne9iM.png
I attempted the following approach as well:
data() {
return{
cloudSvg: require('./TheCloud.svg')
}
},
However, this did not work as expected and produced this result instead:
https://i.sstatic.net/r1ZYD.png
Is there another way to achieve this without having to place the SVG source inside javascript files? It seems like there should be a simpler solution.