What does it mean to return Promise and be reject

when I switch tabs, I will decide whether to switch tabs according to the user"s choice. The tabs use the tabs component of elemenui. I think there is a before-leave method in the document as shown in figure

.

clipboard.png

my code:

this.$confirm("?", "", {
            confirmButtonText: "",
            cancelButtonText: "",
            type: "warning"
        }).then(() => {
            return true;
        }).catch(() => {
            return false
        });

returnfalse, when I choose to cancel, but this does not prevent switching, so I vaguely feel that I want to use this sentence in the document to prevent "returning Promise and being blocked by reject,." ,
but I really don"t know how to write it. Ask for advice

Apr.02,2021

directly put $confirm return back to try, because $confirm originally returns a Promise

.
return this.$confirm('?', '', {
            confirmButtonText: '',
            cancelButtonText: '',
            type: 'warning'
        })

try this:

return new Promise((res,rej)=>{
    this.$confirm('?', '', {
            confirmButtonText: '',
            cancelButtonText: '',
            type: 'warning'
        }).then(() => {
            res()
        }).catch(() => {
            rej()
        });
}
        )

you should return a promise

return new Promise(resolve, reject) {

this.$confirm('?', '', {
            confirmButtonText: '',
            cancelButtonText: '',
            type: 'warning'
        }).then(() => {
            resolve()
        }).catch(() => {
            reject()
        });
}

try it

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bee1e8-31bd9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bee1e8-31bd9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?