当前位置:网站首页>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
边栏推荐
- 【最详细】最新最全Redis面试大全(50道)
- 4279. 笛卡尔树
- Crontab scheduled task
- 《指环王:力量之戒》新剧照 力量之戒铸造者亮相
- JMeter JSON extractor extracts two parameters at the same time
- Strategy mode
- Flask Foundation
- 高并发内存池
- File operation serialization recursive copy
- 2. E-commerce tool cefsharp autojs MySQL Alibaba cloud react C RPA automated script, open source log
猜你喜欢

SecureCRT password to cancel session recording

高并发内存池

Basic components and intermediate components

Distributed transactions

Sorting out the core ideas of the pyramid principle

C code production YUV420 planar format file

Discussion on some problems of array

3311. 最长算术

深度学习参数初始化(一)Xavier初始化 含代码

POI excel percentage
随机推荐
7.2刷题两个
Distributed ID
【CMake】CMake链接SQLite库
II. D3.js draw a simple figure -- circle
20220319
“百度杯”CTF比赛 2017 二月场,Web:爆破-1
On the practice of performance optimization and stability guarantee
php安装swoole扩展
Interfaces and related concepts
Strategy mode
Resttemplate configuration use
Laravel Web框架
JMeter JSON extractor extracts two parameters at the same time
My 2020 summary "don't love the past, indulge in moving forward"
多个全局异常处理类,怎么规定执行顺序
IP home online query platform
JMeter test result output
[untitled]
php安装composer
[set theory] equivalence classes (concept of equivalence classes | examples of equivalence classes | properties of equivalence classes | quotient sets | examples of quotient sets)*