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

this$1.data is not a function when using as a module #2

Open
scottgrayson opened this issue Dec 29, 2016 · 1 comment
Open

this$1.data is not a function when using as a module #2

scottgrayson opened this issue Dec 29, 2016 · 1 comment

Comments

@scottgrayson
Copy link

I think this is related to webpack, but not sure. the name data didnt work for this method. changing it to getData() worked

  /**
   * Fetch all relevant data for the form.
   */
  getData () {
    const data = {}

    for (const property in this.originalData) {
      data[property] = this[property]
    }

    return data
  }

image

@nonDeath
Copy link

nonDeath commented Jul 15, 2017

By some strange reason, if the instance of the Form class not is named form, and the data attribute is called data, this failure is thrown.

I try using

....
data: () => {
links:  new Form({....})
...
}
...
// in some method
    links.post('url-to-end-point')
        .then(...)
        .catch(...)

And its fails with the message links.post is not a function

But instead changing links by form magiclly works! I'm not a expert on javascript but this is a no sence behavior. Or a colateral behavior by using some declaration in some place in the code.

Please somebody help me to understand it...

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

2 participants