当前位置:网站首页>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
边栏推荐
- Interview questions about producers and consumers (important)
- 4279. Cartesian tree
- TypeScript let與var的區別
- 2021-07-18
- Summary of abnormal mechanism of interview
- “百度杯”CTF比赛 2017 二月场,Web:爆破-1
- On the practice of performance optimization and stability guarantee
- Docker builds MySQL: the specified path of version 5.7 cannot be mounted.
- 4279. 笛卡尔树
- C WinForm framework
猜你喜欢

C代码生产YUV420 planar格式文件

Summary of abnormal mechanism of interview

Mise en place d'un environnement de développement de fonctions personnalisées
![[solved] unknown error 1146](/img/f1/b8dd3ca8359ac9eb19e1911bd3790a.png)
[solved] unknown error 1146

3311. 最长算术

Basic knowledge about SQL database

dataworks自定义函数开发环境搭建

Pits encountered in the use of El checkbox group

4279. 笛卡尔树

Arctic code vault contributor
随机推荐
gstreamer ffmpeg avdec解码数据流向分析
[most detailed] latest and complete redis interview book (50)
The difference between typescript let and VaR
Interfaces and related concepts
Advanced API (UDP connection & map set & collection set)
[solved] sqlexception: invalid value for getint() - 'Tian Peng‘
How can I split a string at the first occurrence of “-” (minus sign) into two $vars with PHP?
crontab定时任务
[HCAI] learning summary OSI model
TCP cumulative acknowledgement and window value update
Common APIs
Unit test notes
[cmake] cmake link SQLite Library
Discussion on some problems of array
《指環王:力量之戒》新劇照 力量之戒鑄造者亮相
Win 10 find the port and close the port
Advanced API (batch image Download & socket dialog)
[set theory] equivalence classes (concept of equivalence classes | examples of equivalence classes | properties of equivalence classes | quotient sets | examples of quotient sets)*
“百度杯”CTF比赛 2017 二月场,Web:爆破-1
3311. 最长算术