Error after upgrade to latest version for triggering QBtn on enter
-
I am having a log in page username and password field . When we are finished typing password and press enter , I triggered to call the click function of QBtn . It was working fine before update. Now I get the below mentioned errror.
TypeError: Cannot read property ‘defaultPrevented’ of undefined
at VueComponent.click (QBtn.js?9c40:48)
at VueComponent.trigger (master.vue?4509:119)
at keyup (master.vue?19fd:125)
at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
at HTMLInputElement.invoker (vue.runtime.esm.js?2b0e:2179)
at HTMLInputElement.original._wrapper (vue.runtime.esm.js?2b0e:6911)
logError @ vue.runtime.esm.js?2b0e:1888
globalHandleError @ vue.runtime.esm.js?2b0e:1879
handleError @ vue.runtime.esm.js?2b0e:1839
invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1862
invoker @ vue.runtime.esm.js?2b0e:2179
original._wrapper @ vue.runtime.esm.js?2b0e:6911Now I have to click on the button to log in. What could be the reason?
-
In order for the user to be able to activate the @submit events on the form, create a QBtn with type set to submit
<q-form @submit.prevent="yourSubmitMethod" > // your form <q-btn label="Submit" type="submit" color="primary"/> </q-form>
-
Same problem here. I had a piece of working code which has stopped working. Just to make sure, I have just updated Quasar to 1.2.5 and so on, and the error persists. In my case the
<q-btn>
tag has aref="button"
which is contained in a<q-tab-panel name="whatever" @keyup.enter.native="$refs.button.click()">
. Pressing the enter key was triggering the click action of the button. Now it gives the error above. Thanks. -
$refs.button.$el.click()
-
Yes, it does work with
$el
. Thanks a lot! -
For those who want to know why this is so or shed some additional light, check: https://stackoverflow.com/questions/58546283/why-is-el-sometimes-necessary-when-using-refs-in-vue