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

Blurring the component after onSelect #225

Closed
pasictarik opened this issue Oct 7, 2019 · 3 comments
Closed

Blurring the component after onSelect #225

pasictarik opened this issue Oct 7, 2019 · 3 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@pasictarik
Copy link

Loving the component so far, and using it on my current project. However, there is a feature that I would like you to add and that seems fit for this component. It would be great to have a prop to invoke blur after selecting an item, or to be able to emit blur inside the select event.

I tried doing this by emitting blur inside the select event handler as in
onSelect (item) { console.log('select', this.$refs.coolselect) this.$refs.coolselect.$emit('blur'); }

also tried
onSelect (item) { this.$refs.coolselect.wishShowMenu = false; this.$refs.coolselect.focused = false; }

however niether work, also tried setting a timeout, that doesn't work either. If you have another option that I could try, please let me know. I did not try emitting blur outside the onSelect listener but I believe that I should be allowed to blur it inside.

the component is awesome I hope that you'll add this feature soon

@iliyaZelenko
Copy link
Owner

iliyaZelenko commented Oct 7, 2019

Hi, thanks for using the component. I’ll help you with joy. I think the following code will help you:

<cool-select
  ref="select"
  v-model="selected"
  :items="items"
  @select="onSelect"
/>

and method onSelect:

onSelect () {
  this.$refs.select.setBlured()
}

It works for me. Method setBlured is used inside this component for this purpose. Hope this works for you too, let me know.

@iliyaZelenko iliyaZelenko added enhancement New feature or request question Further information is requested labels Oct 7, 2019
@pasictarik
Copy link
Author

wow I feel awful hahahah, I tried that too initially but instead of writing "setBlured()" I used "setBlurred()", and kept getting 'setBlurred()' is not a function 🤣. Isn't blurred grammatically correct?

Thanks a lot, it works perfectly now !

@iliyaZelenko
Copy link
Owner

Wow, haha, excuse me for such a name for the function. The fact is that I do not have a high level in English and I can make such mistakes. This is an interesting situation, each of us has gained experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants