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

Respect v-model modifier lazy #114

Open
gebeer opened this issue Apr 9, 2021 · 2 comments
Open

Respect v-model modifier lazy #114

gebeer opened this issue Apr 9, 2021 · 2 comments
Labels
looking for community support Interested, but not something the maintainer expects to get to soon.

Comments

@gebeer
Copy link

gebeer commented Apr 9, 2021

Thanks for maintaining this.
I need lazy behaviour on v-model, like v-model.lazy="name". But it doesn't seem to be implemented in this component.

My problem: the component is bound to a data property 'name'. On change of this property, I trigger a filter method that filters through hundreds of objects. ATM my filter method is being triggered on every keystroke which is bad for performance.

Would be great if you could implement the native .lazy modifier on v-model.

@mattzollinhofer
Copy link
Owner

Yeah, I can see the value in this idea. Honestly, there’s probably a lot of other things that need work first, but I’ll keep this on the list and will be interested if others see the need as well.

A workaround for you might be to use denounce to limit calls while typing, but obviously I don’t know hire you’re implementing this so that suggestion might not work.

@mattzollinhofer mattzollinhofer added the looking for community support Interested, but not something the maintainer expects to get to soon. label Apr 9, 2021
@gebeer
Copy link
Author

gebeer commented Apr 10, 2021

Great to hear that you'll keep this in the loop.
Meanwhile I managed to workaround using your custom hit event which does exactly what I need.

<vue-typeahead-bootstrap
          @hit="setName"
          ...

then in my methods

  methods: {
    setName(val) {
      this.name = val;
    },
  },

Now I can watch the name property and filter my results accordingly :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
looking for community support Interested, but not something the maintainer expects to get to soon.
Projects
None yet
Development

No branches or pull requests

2 participants