Vue listens for browser window close events

I want to clear cookie, after closing the window. How can I listen for the window closing event in vue?

Feb.28,2021

you can listen through window.onbeforeunload that before the window closes, you can declare a function and then clear cookie


window.onbeforeunload = function(){
    ... //do someting
}

what if onbeforeunload fails to execute an asynchronous request?

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-1c21f94-15af0.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-1c21f94-15af0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?