2020-12-09 keep-alive 需要局部更新

生命周期执行顺序:
  1、不使用keep-alive的情况:beforeRouteEnter --> created --> mounted --> destroyed
  2、使用keep-alive的情况:beforeRouteEnter --> created --> mounted --> activated --> deactivated
  3、使用keep-alive,并且再次进入了缓存页面的情况:beforeRouteEnter -->activated --> deactivated

被keep-alive包裹住的页面都会被缓存,如果想刷新部分内容要启用activated函数,用法同created,activated只有在被keep-alive包裹时会触发,activated函数一进入页面就触发

你可能感兴趣的:(2020-12-09 keep-alive 需要局部更新)