BeforeDestroy does not work

problem description

use window.localStorage to cache some simple data in the vue lifecycle beforeDestroy, but none of it works.
tried console.log or something, and it didn"t work in this life cycle.

related codes

beforeDestroy(){
    let vm = this;
    window.localStorage.card = "11";
}

Jun.29,2021

how do you judge that it didn't work?

is it just that this method is not executed? But the execution of this method requires the component to be uninstalled. How do you make the component uninstall

Menu