here is the component from where I am taking the input from the user and saving it in variables. I want this value to be updates in the other component as soon as the submit button is hit.
<script>
import { onMount } from "svelte";
let url=[];
onMount(() => {
onClickGetNotes()
});
async function onClickGetNotes() {
console.log(url.url)
}
</script>
<form on:submit|preventDefault={onClickGetNotes}>
<input label="url" bind:value={url.url} placeholder="enter id here"/>
<button>Submit</button>
</form>
Here is the second component where I want the entered url to be updated for imageoverlay for leaflet.
<script>
import { onMount } from "svelte";
import L from "leaflet";
var url
var map
var layerGroup
// code for map
onMount(() => {
map = L.map('issmap', {
.....
crs: L.CRS.Simple
});
var w = 500,
h = 500,
url = 'https://pp.vk.me/c837734/v837734326/d436/zlt_Wifq2NU.jpg';
......
layerGroup = L.layerGroup().addTo(map);
});
</script>
.....
The whole idea is to get the url for the user and update it in the leafletmap.
how can i do this ?