Skip to content
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

call function inside data() have tried to fetch data with axios like the documentation but getting an error #113

Open
maikenmadsen1992 opened this issue Apr 11, 2019 · 0 comments

Comments

@maikenmadsen1992
Copy link

maikenmadsen1992 commented Apr 11, 2019

Thank you so much for this great library :-)

I'm trying to fetching some data for my search tree and i'm not able to get the data directly from axios or to call a function because it can't find this.

export default {
  name: 'SideNavMenu',
    data () {
      return {
         searchValue: '',
         treeData: this.getData(),
         treeOptions: {

              fetchData(node) {
                this.onNodeSelected(node)

         }
      },
  }
 },

In the data() I have treeOptions where I want to call a function called onNodeSelected. The error message is:

"TypeError: this.onNodeSelected is not a function"

can anybody help?

I have tried:

 fetchData(node) {
    return axios.get('/user', {
       params: {
        ID: node.id
      }
     })
    }

But not able to 'get'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant