CodePudding user response:
After page is closed if not use the keep alive - vue automatically destroy the componentCodePudding user response:
Use the keep aliveCodePudding user response:
Have a great god knows how to solveCodePudding user response:
Recently I also useful to this thing, also have to meet you this similar problem, thinking for a long time, without a look at the source level thought of a way, also did not practice, said come out, let's talk about the main idea is to use the component of include attribute, we again vuex maintenance inside an array, each one to cache the page to push a data inside, then close the page each time, both in the hook to the corresponding page is removed from the array, keepalive components include attributes, binding for the array of vuex, should can achieve this effect, temporarily so, for a while to study the keepalive source, see if there are any better way,CodePudding user response:
I just use the way you said, the memory is not destroyedCodePudding user response:
Use the keep alive
CodePudding user response:
This counterintuitive, you use the keep alive - was to leave when the page cache, but you want to exit the page again destroy memory,CodePudding user response:
Try beforeDestory, when executing the lifecycle hooks vue instance from running stage into the destruction stage instance at this time of the data and the methods in the available state,