之前學習了基礎的生命周期鈎子(beforeCreate,created,beforeMonted,mounted.beforUpdate,update,beforDestroy,destroyed)
該鈎子用在什么情況下
當在這些組件之間切換的時候都會請求一些請求過的數據,每次請求都會導致重復渲染影響性能。這些數據可以存到緩存。此時使用keep-alive將組建包裹起來。但這樣以上八種生命周期鈎子將失效。取而代之的時activate和deactivated
activate:是在被包裹組建被激活的狀態下使用的生命周期鈎子
deactivated:在被包裹組件停止使用時調用