Skip to content

Form in class component not work #392

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

Closed
1 task
zhdwwf opened this issue Jan 11, 2019 · 4 comments
Closed
1 task

Form in class component not work #392

zhdwwf opened this issue Jan 11, 2019 · 4 comments
Labels

Comments

@zhdwwf
Copy link

zhdwwf commented Jan 11, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.2.5

Environment

windows 10 chrome 71 Vue 2.5.21

Reproduction link

https://github.com/zhdwwf/adv-ts-demo

Steps to reproduce

git clone https://github.com/zhdwwf/adv-ts-demo.git
npm install
npm run serve
visit http://localhost:8080

The input component can't type any words,like this.
image
image

What is expected?

The input work normally

What is actually happening?

The input can't type any words

@tangjinzhou
Copy link
Member

export default class App extends Vue {
  // public form: any = this.$form.createForm(this);
  created () {
    this.form = this.$form.createForm(this)
  }
  // or use data
  // data() {
  //   return {
  //     form:  this.$form.createForm(this),
  //   }
  // }
}

this is not this
I do not know why. I think it is a problem with vue-class-component.
You can create a form collector using created or data.

@tangjinzhou tangjinzhou changed the title Form in typescript not work Form in class component not work Jan 11, 2019
@zhdwwf zhdwwf closed this as completed Jan 11, 2019
@ux-engineer
Copy link

Experiencing this issue likewise.

@HenryYong
Copy link

export default class App extends Vue {
  // public form: any = this.$form.createForm(this);
  created () {
    this.form = this.$form.createForm(this)
  }
  // or use data
  // data() {
  //   return {
  //     form:  this.$form.createForm(this),
  //   }
  // }
}

this is not this
I do not know why. I think it is a problem with vue-class-component.
You can create a form collector using created or data.

Having exactly the same issue...and this solution works for me...

Meanwhile, if I am using public form: any = this.$form.createForm(this); and add following code in v-decorator, after I type in input, I find that value is replaced by what I last type

onValuesChange (props, value) {
    console.log('props', props)
     console.log('value', value)
}

Anyway, I hope this issue could be treated as a bug and be fixed soon... thx

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants