New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
accessing the $store #22
Comments
maybe a better question is how can i access a variable on the page or in the store from the fetchdata function? |
Probably your case isn't connected to the library. Could you try this code: treeOptions: {
store: this.$store,
fetchData: (node) => {
return HTTP.get(`/api/websitenavigation?nodeid=${node.id}&websiteId=${this.store.getters.websiteId}`)
.then(function (response) { return response.data })
.catch(function (err) { console.log(err); })
}
} |
Uncaught (in promise) TypeError: Cannot read property 'state' of undefined |
Oh, you have wrong |
i see you can pass in a variable to the options called store where you can access the store to get values(using in fetch data), but i'm getting some weird errors.
Uncaught (in promise) TypeError: Cannot read property 'state' of undefined
at a (liquor-tree.esm.js?6487:6)
at VueComponent.connectStore (liquor-tree.esm.js?6487:6)
at eval (liquor-tree.esm.js?6487:6)
how i'm calling it/configuration:
<tree v-if="websiteId != 0" :options="treeOptions" @node:selected="onNodeSelected" />
treeOptions: {
store: this.$store,
fetchData (node) {
return HTTP.get(
/api/websitenavigation?nodeid=${node.id}&websiteId=${this.store.getters.websiteId}
).then(function (response) { return response.data })}
}
if i take out the store: this.$store and hard code the id (${this.store.getters.websiteId}, i get exactly as i would expect it to work. any ideas or help?
thanks,
matt
The text was updated successfully, but these errors were encountered: