Closed wendellwt closed 3 years ago
Nevermind. For whatever reason, this works:
<vl-source-vector ... :loader-factory="loaderFactoryOuter" />
loaderFactoryOuter() {
return (extent, resolution, projection) => this.loaderFactoryInner(extent, resolution, projection)
},
loaderFactoryInner(extent, resolution, projection) {
return fetch(this.my_Url)
.then(response => response.json())
.then(data => {
...
this.$root.$emit('mytag', (something) );
return(data);
})}
Hello @wendellwt ,
in the first code sample you define loaderFactory
with arrow function, so it don't have any this
context by definition.
Second code sample is exactly how it is supposed to be used.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Thank you for vuelayers; it is great! I have a question about
vl-source-vector
and :loader-factory.I have a loaderFactory running fine, but can't get it to communicate with the rest of Vue. "
this
" seems to be undefined, and any arguments to my loaderFactory(vm) seem to be undefined also. I would like to do something like:How do I reference the data section or the $emit function? Thank you.