Skip to content

[mdField] keydown.enter sometimes got InputEvent object as it's v-model value #1160

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
VdustR opened this issue Nov 17, 2017 · 4 comments · Fixed by #1196
Closed

[mdField] keydown.enter sometimes got InputEvent object as it's v-model value #1160

VdustR opened this issue Nov 17, 2017 · 4 comments · Fixed by #1196
Assignees
Labels

Comments

@VdustR
Copy link
Member

VdustR commented Nov 17, 2017

Steps to reproduce

In the official website, go to Vue Material - Chips page.

Check Editable model example and insert chips quickly.

Got result like:
selection_001

I console.log that value in insertChip() method got this:

  • Chrome: image
  • Firefox: image

Which browser?

Google Chrome 62.0.3202.94 (64bit) and Firefox 56.0 (64bit) tested.

What is expected?

v-model value should always be String.

What is actually happening?

Sometimes got InputEvent object.

Reproduction Link

https://vuematerial.io/components/chips

@marcosmoura
Copy link
Member

This is due a change in Vue 2.5.3. I will change my implementation here to match with those changes.

@marcosmoura marcosmoura self-assigned this Nov 18, 2017
@VdustR
Copy link
Member Author

VdustR commented Nov 22, 2017

Related to Vue#6846, #7042.

After studying #7042#issuecomment-344948474, I tried:

<input type='text' v-model='model' v-bind='$attrs' 
  v-on="{
    ...$listeners,
    input: event => $emit('input', event.target.value)
  }">

and it works.

Demo: Codepen

@korylprince
Copy link
Contributor

korylprince commented Nov 24, 2017

FYI, this happens even on md-input, and it fires on every keypress.

@marcosmoura
Copy link
Member

Already fixed. Will release this soon!

marcosmoura pushed a commit that referenced this issue Nov 27, 2017
* fix(MdInput): Avoid InputEvent object from @input event

fix #1160

* fix(MdField): `$emit` missing `this`

* fix(MdSelect): declare all MdSelect properties in `data()` and make `MdSelect.modelValue` synced wit

* feat(MdField): make 'v-model'/'value' in MdFile, MdInput, MdSelect, MdTextarea optional

`MdSelect` could be switched between single and multiple

fix #1150

* feat(MdSelect): one way update with `value`

* fix(MdOption): let value avaiable to be `0`

fix #1203

* fix(MdField): set value default as null

* fix(MdField): Remove value default

#1196 (comment)

* style(MdSelect): brackets for if statement execute block

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

Successfully merging a pull request may close this issue.

3 participants