keep-alive 新增的两个函数 activated dea
作者:
曾经也是个少年 | 来源:发表于
2019-04-22 14:40 被阅读0次include:缓存;
exclude:不缓存;
<keep-alive include="test-keep-alive">
<!-- 将缓存name为test-keep-alive的组件 -->
<component></component>
</keep-alive>
<keep-alive include="demoA,demoB">
<!-- 将缓存name为a或者b的组件,结合动态组件使用 -->
<component :is="view"></component>
</keep-alive>
<!-- 使用正则表达式,需使用v-bind -->
<keep-alive :include="/demoA|demoB/">
<component :is="view"></component>
</keep-alive>
<!-- 动态判断 -->
<keep-alive :include="includedComponents">
<router-view></router-view>
</keep-alive>
<keep-alive exclude="test-keep-alive">
<!-- 将不缓存name为test-keep-alive的组件 -->
<component></component>
模块缓存后悔新增两个方法activated (进入页面时调用)deactivated(离开页面时调用),主要实现方式是监听路由变化
本文标题:keep-alive 新增的两个函数 activated dea
本文链接:https://www.haomeiwen.com/subject/bdvygqtx.html
网友评论