How to insert a piece of logic before the execution of the .then () function of the MessageBox () promise object encapsulated by elementUI

MessageBox()
    .then(() => {
       console.log(1)
    }).catch(() => {
       console.log(2)
    })

MessageBox () is a pop-up window method encapsulated by elementUI. The pop-up window method contains a confirm and cancel button. Make sure to go then () and cancel catch ()

.

this method opens the pop-up window by default and lets the OK button get focus.

and I want the cancel button to get focus by default,

MessageBox does not provide a corresponding api, but can only write its own logic implementation.

so how can I, after the pop-up window opens,

before clicking the OK and cancel buttons,

insert a piece of code to execute the logic that gives the cancel button focus?


use Dialog dialog box, you can do whatever you want


confirmButtonText: 'cancel',
cancelButtonText:'OK'

Menu