You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is one event firing if the modal is closed "update:show". It doesn't specify how it was closed, so you need to create own 'footer' slot with buttons that have custom events.
then what is the point of the OK and Cancel button of the CModal? it doesnt make any sense. If it has buttons then it has to register events for them .
I see the fix but I still have no idea how to access the accept variable from the .sync event. Please update the documentation with an example or at least provide one here.
Editing my comment to provide an example that I figured out in case anyone else comes across this. Add an event listener to the Modal
<CModal title="Confirm Delete" color="danger" :show.sync="warningModal" @update:show="closeModal" > Are you sure you want to delete this variant? </CModal>
Then have a method called closeModal that takes 3 arguments: closeModal(status, evt, accept) { if (accept) { //Ok was clicked so do whatever you want } }
bettafish15, atjhoendz, i3130002, garagepoort, Marthianfred and 4 morepaolodina, Marthianfred and abaumggeri777
Activity
woothu commentedon May 12, 2020
https://coreui.io/vue/docs/components/modal.html
yaswanthkoneri commentedon May 12, 2020
@woothu Documentation is not clear
woothu commentedon May 12, 2020
There is one event firing if the modal is closed "update:show". It doesn't specify how it was closed, so you need to create own 'footer' slot with buttons that have custom events.
bettafish15 commentedon Jul 8, 2020
then what is the point of the OK and Cancel button of the CModal? it doesnt make any sense. If it has buttons then it has to register events for them .
woothu commentedon Jul 8, 2020
@bettafish15 good point
fix: CModal: 'update:show' event - add third argument 'accept' #92
woothu commentedon Jul 10, 2020
In 3.1.1 version there is the third argument
accept
in theupdate:show
event, it is true only if 'ok' button is clicked.cocobienak commentedon Oct 14, 2020
how to use that,, can you give the example code.
bitbandit01 commentedon Dec 14, 2020
I see the fix but I still have no idea how to access the accept variable from the .sync event. Please update the documentation with an example or at least provide one here.
Editing my comment to provide an example that I figured out in case anyone else comes across this. Add an event listener to the Modal
<CModal title="Confirm Delete" color="danger" :show.sync="warningModal" @update:show="closeModal" > Are you sure you want to delete this variant? </CModal>
Then have a method called closeModal that takes 3 arguments:
closeModal(status, evt, accept) { if (accept) { //Ok was clicked so do whatever you want } }
geri777 commentedon Nov 3, 2023
For the OK button this is fine. But I also need to distinguish between the [Cancel] button and [X].