2
Template:
<input type="text" v-model.trim="enterURL" placeholder="Enter URL here" @keyup.enter="Entered">
<v-btn icon @click.native.stop="Entered">
<v-icon>send</v-icon>
</v-btn>
Script:
Entered(enterURL) {
this.$emit('Entered', enterURL);
let an_url = enterURL.target.value;
if (this.layers_includes(an_url))
return;
axios.get(an_url).then(response => {
let a_layer = new Layer();
a_layer.enabled = true;
a_layer.json = response.data;
a_layer.url = an_url;
this.layers.push(a_layer);
L.geoJSON(a_layer.json).addTo(map);
this.add_layer(a_layer);
});
Pressing 'Enter' works normally, but with the mouse click on the button appears this error on the console:
Uncaught (in promise) TypeError: Cannot read property 'protocol' of undefined
at isURLSameOrigin (isURLSameOrigin.js?142d:57)
at dispatchXhrRequest (5:109)
at Promise (<anonymous>)
at xhrAdapter (5:12)
at dispatchRequest (26:52)
at <anonymous>