当前位置:网站首页>Realize the reuse of components with different routing parameters and monitor the changes of routing parameters
Realize the reuse of components with different routing parameters and monitor the changes of routing parameters
2022-07-03 07:17:00 【darabiuz】
- Premise
When using different routing parameters , The original component instance will be reused . Because both routes render the same component , Rather than destroy and recreate , Reuse is more efficient . however , This also means that the component's lifecycle hook is no longer called . Therefore, we need to monitor the changes of routing parameters to get different data rendering effects of the page - Use watch Listen for changes in routing parameters
watch: {
// Used to monitor routing parameters '$route.params.id' The change of ,handler Method represents the action taken after listening to the change of routing parameters , Parameters newVal Represents the new value
'$route.params.id': {
handler (newVal) {
console.log(newVal);
// Here is the action to be performed after monitoring the parameter change
},
immediate: true,
deep: true
}
}
watch See the official website for the usage of and the response to changes in routing parameters api:
link 1
link 2
边栏推荐
- In depth analysis of reentrantlock fair lock and unfair lock source code implementation
- php artisan
- Jmeter+influxdb+grafana of performance tools to create visual real-time monitoring of pressure measurement -- problem record
- Troubleshooting of high CPU load but low CPU usage
- Selenium key knowledge explanation
- Common APIs
- [cmake] cmake link SQLite Library
- Laravel Web框架
- 《指环王:力量之戒》新剧照 力量之戒铸造者亮相
- Dora (discover offer request recognition) process of obtaining IP address
猜你喜欢

Store WordPress media content on 4everland to complete decentralized storage

C代码生产YUV420 planar格式文件

Specified interval inversion in the linked list

3311. 最长算术

Summary of abnormal mechanism of interview
![PdfWriter. GetInstance throws system Nullreferenceexception [en] pdfwriter GetInstance throws System. NullRef](/img/65/1f28071fc15e76abb37f1b128e1d90.jpg)
PdfWriter. GetInstance throws system Nullreferenceexception [en] pdfwriter GetInstance throws System. NullRef
![[vscode - vehicle plug-in reports an error] cannot find module 'xxx' or its corresponding type declarations Vetur(2307)](/img/7f/3d6b6ea5319f7165e07baf0a78d318.jpg)
[vscode - vehicle plug-in reports an error] cannot find module 'xxx' or its corresponding type declarations Vetur(2307)

POI excel percentage

SecureCRT password to cancel session recording
![[solved] sqlexception: invalid value for getint() - 'Tian Peng‘](/img/bf/f6310304d58d964b3d09a9d011ddb5.png)
[solved] sqlexception: invalid value for getint() - 'Tian Peng‘
随机推荐
Pits encountered in the use of El checkbox group
Win 10 find the port and close the port
My 2020 summary "don't love the past, indulge in moving forward"
Advanced API (use of file class)
Use the jvisualvm tool ----- tocmat to start JMX monitoring
On the practice of performance optimization and stability guarantee
Laravel框架 踩坑(一)
4279. Cartesian tree
Le Seigneur des anneaux: l'anneau du pouvoir
SecureCRT password to cancel session recording
Liang Ning: 30 lectures on brain map notes for growth thinking
Inno setup production and installation package
Dora (discover offer request recognition) process of obtaining IP address
万卷书 - 价值投资者指南 [The Education of a Value Investor]
CentOS switches and installs mysql5.7 and mysql8.0
Strategy mode
Final, override, polymorphism, abstraction, interface
mysql误删root账户导致无法登录
C代码生产YUV420 planar格式文件
Troubleshooting of high CPU load but low CPU usage