当前位置:网站首页>Learn Chapter 20 of vue3 (keep alive cache component)
Learn Chapter 20 of vue3 (keep alive cache component)
2022-07-01 04:13:00 【Xiaoman ZS】
Built in components keep-alive
Sometimes we don't want components to be re rendered to affect the user experience ; Or in terms of performance , Avoid repeated rendering to reduce performance . I want the components to be cached , Maintain the current state . And that's where it comes in keep-alive Components .
Turn on keep-alive Life cycle change
- When I first entered : onMounted> onActivated
- Trigger after exit
deactivated - Once again into the :
- It will only trigger onActivated
- How to mount the event, etc , The one-time execution is placed in onMounted in ; Every time a component goes in, its execution method is placed in onActivated in
<!-- basic -->
<keep-alive>
<component :is="view"></component>
</keep-alive>
<!-- Sub components of multiple conditional judgments -->
<keep-alive>
<comp-a v-if="a > 1"></comp-a>
<comp-b v-else></comp-b>
</keep-alive>
<!-- and `<transition>` Use it together -->
<transition>
<keep-alive>
<component :is="view"></component>
</keep-alive>
</transition> include and exclude
<keep-alive :include="" :exclude="" :max=""></keep-alive>include and exclude prop Allow components to conditionally cache . Both can be comma separated strings 、 Regular expressions or an array to represent :
max
<keep-alive :max="10">
<component :is="view"></component>
</keep-alive>边栏推荐
- 187. repeated DNA sequences
- NFT:使用 EIP-2981 开启 NFT 版税之旅
- ThreeJS开篇
- 674. longest continuous increasing sequence force buckle JS
- 盘点华为云GaussDB(for Redis)六大秒级能力
- Some small knowledge points
- 【TA-霜狼_may-《百人计划》】1.2.2 矩阵计算
- [untitled] Li Kou 496 Next larger element I
- Unexpected token o in JSON at position 1, JSON parsing problem
- 171. excel table column No
猜你喜欢

创新界,聚势行 | 2022人大金仓“百城巡展”火热开启

"Target detection" + "visual understanding" realizes the understanding of the input image

小程序中自定义组件

Loop filtering based on Unet
![[send email with error] 535 error:authentication failed](/img/58/8cd22fed1557077994cd78fd29f596.png)
[send email with error] 535 error:authentication failed

Usage of AfxMessageBox and MessageBox
![[human version] Web3 privacy game in the dark forest](/img/89/e16789b7f3892002748aab309c45e6.png)
[human version] Web3 privacy game in the dark forest

【TA-霜狼_may-《百人计划》】1.2.2 矩阵计算

Embedded System Development Notes 79: why should I get the IP address of the local network card

Leetcode learning - day 36
随机推荐
Usage of AfxMessageBox and MessageBox
【深度学习】(4) Transformer 中的 Decoder 机制,附Pytorch完整代码
【人话版】WEB3黑暗森林中的隐私博弈
Valid @suppresswarnings warning name
25.k sets of flipped linked lists
241. Design priorities for operational expressions
JMeter login failure, extracting login token, and obtaining token problem solving
嵌入式系統開發筆記80:應用Qt Designer進行主界面設計
392. judgment subsequence
242. valid Letter heteronyms
In the innovation community, the "100 cities Tour" of the gold warehouse of the National People's Congress of 2022 was launched
Analyse et cas du modèle pageobject
陈宇(Aqua)-安全-&gt;云安全-&gt;多云安全
Huawei simulator ENSP - hcip - Hybrid Experiment 2
Possible problems and solutions of using scroll view to implement slider view
定了!2022京东全球科技探索者大会之京东云峰会7月13日北京见
One job hopping up 8K, three times in five years
Millet College wechat scanning code login process record and bug resolution
小程序中自定义组件
Ospfb notes - five messages [ultra detailed] [Hello message, DD message, LSR message, LSU message, lsack message]