当前位置:网站首页>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
边栏推荐
- Basic components and intermediate components
- TypeScript let與var的區別
- PdfWriter. GetInstance throws system Nullreferenceexception [en] pdfwriter GetInstance throws System. NullRef
- [solved] win10 cannot find a solution to the local group policy editor
- php安装composer
- File links cannot be opened or downloaded in Google browser
- Wireshark software usage
- [untitled]
- Resthighlevelclient gets the mapping of an index
- PHP install composer
猜你喜欢
Inno setup production and installation package
Selenium key knowledge explanation
Wireshark software usage
[Fiddler problem] solve the problem about Fiddler's packet capturing. After the mobile network is configured with an agent, it cannot access the Internet
“百度杯”CTF比赛 2017 二月场,Web:爆破-1
In depth analysis of reentrantlock fair lock and unfair lock source code implementation
Final, override, polymorphism, abstraction, interface
Specified interval inversion in the linked list
JUC forkjoinpool branch merge framework - work theft
Store WordPress media content on 4everland to complete decentralized storage
随机推荐
Pits encountered in the use of El checkbox group
Mise en place d'un environnement de développement de fonctions personnalisées
Advanced API (byte stream & buffer stream)
[Fiddler actual operation] how to use Fiddler to capture packets on Apple Mobile Phones
【已解决】win10找不到本地组策略编辑器解决方法
php安装swoole扩展
PHP install the spool extension
JMeter JSON extractor extracts two parameters at the same time
Download address collection of various versions of devaexpress
20220319
[Fiddler problem] solve the problem about Fiddler's packet capturing. After the mobile network is configured with an agent, it cannot access the Internet
Deep learning parameter initialization (I) Xavier initialization with code
Operation and maintenance technical support personnel have hardware maintenance experience in Hong Kong
[untitled]
SecureCRT password to cancel session recording
Unit test notes
1. E-commerce tool cefsharp autojs MySQL Alibaba cloud react C RPA automated script, open source log
“百度杯”CTF比赛 2017 二月场,Web:爆破-1
《指环王:力量之戒》新剧照 力量之戒铸造者亮相
Laravel框架 踩坑(一)