<b-modal v-on:ok="save_phone_number">
// Remainder of modal code omitted for clarity
save_phone_number: function(bvModalEvt) {
bvModalEvt.preventDefault()
// do other things here and manually close the modal when done
However, I need to pass some additional arguments. I tried the following, where second and third are the other arguments I'm passing.
<b-modal v-on:ok="save_phone_number(bvModalEvt, second, third)">
save_phone_number: function(bvModalEvt, second, third) {
bvModalEvt.preventDefault()
// do other things here and manually close the modal when done
When I run that, I receive an error when I call preventDefault() that I cannot call preventDefault() on undefined.
I also tried $bvModalEvt in the event binding.
How can I pass bvModalEvt to the function along with other variables?
the bvevent
object is the first argument emitted by the ok
, cancel
, and hide
events. So you can use Vue's special $event
variable (which is the first argument emitted by an event... and not necessarily a native event object, which it is commonly used for):
<b-modal v-on:ok="save_phone_number($event, second, third)">
$event
will contain the bvModal event object.