当前位置:网站首页>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>边栏推荐
- 互联网行业最佳产品开发流程 推荐!
- 【无标题】
- 【TA-霜狼_may-《百人计划》】1.2.2 矩阵计算
- [ta- frost wolf \u may- hundred people plan] 1.1 rendering pipeline
- Custom components in applets
- 程序员女友给我做了一个疲劳驾驶检测
- [TA frost wolf \u may- hundred talents plan] 1.2.2 matrix calculation
- LetCode 1829. Maximum XOR value per query
- Hololens2 development environment building and deploying apps
- NFT:使用 EIP-2981 開啟 NFT 版稅之旅
猜你喜欢

Chen Yu (Aqua) - Safety - & gt; Cloud Security - & gt; Multicloud security

Usage of AfxMessageBox and MessageBox

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

TASK04|数理统计

Unexpected token o in JSON at position 1, JSON parsing problem

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

Obtain detailed ideas for ABCDEF questions of 2022 American Games

NFT: utilisez EIP - 2981 pour commencer un voyage de redevances NFT

类和对象收尾
![[TA frost wolf \u may- hundred talents plan] 1.2.3 MVP matrix operation](/img/4e/8cf60bc816441967c04f97c64685a1.png)
[TA frost wolf \u may- hundred talents plan] 1.2.3 MVP matrix operation
随机推荐
[Master / slave] router election in DD message
Qt开发经验小技巧226-230
LeetCode 1380. Lucky number in matrix
线程常用方法与守护线程
Why can't you find the corresponding function by clicking go to definiton (super easy has a diagram)
Usage of AfxMessageBox and MessageBox
Chen Yu (Aqua) - Safety - & gt; Cloud Security - & gt; Multicloud security
TASK04|數理統計
Embedded System Development Notes 80: using QT designer to design the main interface
不同性能测试工具的并发模式
Valid @suppresswarnings warning name
LetCode 1829. Maximum XOR value per query
【人话版】WEB3黑暗森林中的隐私博弈
Ospfb notes - five messages [ultra detailed] [Hello message, DD message, LSR message, LSU message, lsack message]
What does ft mean in the data book table
Browser top loading (from Zhihu)
NFT: start NFT royalty journey with eip-2981
206. reverse linked list
MySQL function variable stored procedure
283.移动零