Vue: @submit.once.prevent / @submit.prevent.once - Not working as expected

Created on 16 May 2019  路  1Comment  路  Source: vuejs/vue

Version

2.6.10

Reproduction link

https://codesandbox.io/s/vue-template-yfmeh

Steps to reproduce

Create a <form /> with and @submit handler. using either the .prevent and .once handlers work as expected, however in combination it seems to prevent default the first time, but not prevent default the second time resulting in a page refresh.

What is expected?

the form to be submitted only once with no page refresh/reload

What is actually happening?

the form submits correctly the first time, but on the second click it causes a page reload

Most helpful comment

this is expected once will add only the event listener once. Use two event listeners if you want to always prevent default @submit.prevent @submit.prevent.once="..."

>All comments

this is expected once will add only the event listener once. Use two event listeners if you want to always prevent default @submit.prevent @submit.prevent.once="..."

Was this page helpful?
0 / 5 - 0 ratings