当前位置:网站首页>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
边栏推荐
- 2021 year end summary
- Thoughts on project development
- centos php7.2.24升级到php7.3
- Basic knowledge about SQL database
- Interview questions about producers and consumers (important)
- Advanced API (serialization & deserialization)
- Distributed ID
- IP home online query platform
- C代码生产YUV420 planar格式文件
- mysql误删root账户导致无法登录
猜你喜欢

docker建立mysql:5.7版本指定路径挂载不上。

Liang Ning: 30 lectures on brain map notes for growth thinking

Mise en place d'un environnement de développement de fonctions personnalisées

Common problems in io streams

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

Flask Foundation

My 2020 summary "don't love the past, indulge in moving forward"

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

691. 立方体IV

How to specify the execution order for multiple global exception handling classes
随机推荐
crontab定时任务
在 4EVERLAND 上存储 WordPress 媒体内容,完成去中心化存储
Flask Foundation
Advanced API (UDP connection & map set & collection set)
PAT甲级真题1166
TypeScript let與var的區別
centos php7.3安装redis扩展
【CMake】CMake链接SQLite库
4279. Cartesian tree
Distributed lock
Hash table, generic
Reading notes of "learn to ask questions"
Laravel Web框架
Summary of abnormal mechanism of interview
Notes on the core knowledge of Domain Driven Design DDD
SecureCRT取消Session记录的密码
gstreamer ffmpeg avdec解码数据流向分析
GStreamer ffmpeg avdec decoded data flow analysis
Raspberry pie update tool chain
Discussion on some problems of array