当前位置:网站首页>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
边栏推荐
- php安装swoole扩展
- 在 4EVERLAND 上存储 WordPress 媒体内容,完成去中心化存储
- crontab定时任务
- 3311. 最长算术
- Pat grade a real problem 1166
- Common analysis with criteria method
- Win 10 find the port and close the port
- Specified interval inversion in the linked list
- Notes on the core knowledge of Domain Driven Design DDD
- Thoughts in Starbucks
猜你喜欢

File operation serialization recursive copy

Practice of enterprise ab/testing platform

Interview questions about producers and consumers (important)

JMeter JSON extractor extracts two parameters at the same time

Common APIs

Deep learning parameter initialization (I) Xavier initialization with code

JMeter test result output
![[solved] sqlexception: invalid value for getint() - 'Tian Peng‘](/img/bf/f6310304d58d964b3d09a9d011ddb5.png)
[solved] sqlexception: invalid value for getint() - 'Tian Peng‘
![[HCAI] learning summary OSI model](/img/90/66505b22e32aa00b26886a9d5c5e4c.jpg)
[HCAI] learning summary OSI model

3311. 最长算术
随机推荐
Unit test notes
[set theory] equivalence classes (concept of equivalence classes | examples of equivalence classes | properties of equivalence classes | quotient sets | examples of quotient sets)*
Search engine Bing Bing advanced search skills
Pits encountered in the use of El checkbox group
Basic knowledge about SQL database
Advanced API (local simulation download file)
RestHighLevelClient获取某个索引的mapping
I. D3.js hello world
JS date comparison
Sorting out the core ideas of the pyramid principle
4everland: the Web3 Developer Center on IPFs has deployed more than 30000 dapps!
Specified interval inversion in the linked list
691. Cube IV
JUC forkjoinpool branch merge framework - work theft
Inno setup production and installation package
dataworks自定义函数开发环境搭建
7.2刷题两个
Wireshark software usage
10 000 volumes - Guide de l'investisseur en valeur [l'éducation d'un investisseur en valeur]
centos php7.3安装redis扩展