Discussion
Discussion copied to clipboard
Does Vuejs support blur events?
Just wondering if v-on="blur: someFunction"
should work? It doesn't seem to be registering the event listener. Thanks!
Ye it works just fine. Just click on the button and then click somewhere else to trigger the blur event.
http://jsfiddle.net/hajkrupo/4/
Ahh I see what I was doing wrong now. I was declaring each event listener separately (with multiple instances of 'v-on') instead of putting them all under one and separated by a comma, like you have in your example. Silly mistake. Thank you for your help!
@swift1 Hm, your fiddle seems to be broken atm:
vue.js:1023 [Vue warn]: Invalid expression. Generated function body: scope.click:scope.increaseTotal, blur:scope.onBlur
So, what is a way to use blur event now?
The fiddle uses pre-1.0 syntax, but the config points to the latest vue versionl, therefore it's completely broken in its current form.
This is valid 1.0 syntax: https://jsfiddle.net/hajkrupo/25/
For future questions, please visit forum.vuejs.org
You can use in vue v2 @blur="some-method-here"
This worked for me.
<input v-on:blur="myFunctionHere()" />
@blur
works for me with Vue 2.3.2.
v-on:blu or @blur works for me with Vue 2.3.2
blur and click can't be trigger together. <input @blur="function_A"> <button @click="function_B"> if focus into input element first and then click button, will only trigger the function_A, but function_B never been triggered. any body know why?
@blur
works fine for me, thanks @ronaldotn
@TrendAlan I think your answer to your question is here: https://github.com/vuejs/vue/issues/3350
@shaunc869 , thank you. My question is the same with that link, I also used mousedown instead of click, since the button will be hidden when the blur event is triggered, so it can't be clickable any more.