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

@input event not triggered in Select component when using multiple selection #395

Closed
Vaerum opened this issue Feb 14, 2017 · 4 comments
Closed
Milestone

Comments

@Vaerum
Copy link
Contributor

Vaerum commented Feb 14, 2017

Hi
I cannot get the select component to fire the vue event @input.

I have tested the component and it does not fire the set function.

  computed: {
    model: {
      get () {
        if (this.multipleSelection && !Array.isArray(this.value)) {
          console.error('Select model needs to be an array when using multiple selection.')
        }
        return this.value
      },
      set (value) {
       // Does not fire
        this.$emit('input', value)
      }
    },

Can someone see the problem?

Best regards
Rasmus

@rstoenescu rstoenescu changed the title $input is not working in the Select component @input event not triggered in Select component when using multiple selection Feb 14, 2017
@rstoenescu
Copy link
Member

Will investigate and fix. You are probably working with multiple selection so your model is an array. Computed props are not deep watchers.
Workaround would be to make a deep watcher yourself on the scope variable used for v-model on Select.

@Vaerum
Copy link
Contributor Author

Vaerum commented Feb 14, 2017

@rstoenescu thank you. You are correct, it is an array. I will find an work around.

Would it be bad to place the $emit in the get()?

@rstoenescu
Copy link
Member

Yes. Any rerender will emit @input then :) place a watcher in your app code like I mentioned until I got time to fix this.

@rstoenescu
Copy link
Member

Fix available in future v0.14.

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