当前位置:网站首页>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
边栏推荐
- 7.2 brush two questions
- Use of framework
- Download address collection of various versions of devaexpress
- 691. 立方体IV
- sharepoint 2007 versions
- Dora (discover offer request recognition) process of obtaining IP address
- 7.2刷题两个
- gstreamer ffmpeg avdec解码数据流向分析
- php安装composer
- Advanced API (UDP connection & map set & collection set)
猜你喜欢

Jmeter+influxdb+grafana of performance tools to create visual real-time monitoring of pressure measurement -- problem record

On the practice of performance optimization and stability guarantee

SecureCRT password to cancel session recording

Interfaces and related concepts

Discussion on some problems of array

Final, override, polymorphism, abstraction, interface
![[HCAI] learning summary OSI model](/img/90/66505b22e32aa00b26886a9d5c5e4c.jpg)
[HCAI] learning summary OSI model

Setting up the development environment of dataworks custom function

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

Recursion, Fibonacci sequence
随机推荐
[plus de détails] dernière entrevue complète redis (50)
Discussion on some problems of array
[vscode - vehicle plug-in reports an error] cannot find module 'xxx' or its corresponding type declarations Vetur(2307)
Visit Google homepage to display this page, which cannot be displayed
Pat grade a real problem 1166
"Moss ma not found" solution
2. E-commerce tool cefsharp autojs MySQL Alibaba cloud react C RPA automated script, open source log
Gridome + strapi + vercel + PM2 deployment case of [static site (3)]
Resthighlevelclient gets the mapping of an index
[attribute comparison] defer and async
twenty million two hundred and twenty thousand three hundred and nineteen
PdfWriter. GetInstance throws system Nullreferenceexception [en] pdfwriter GetInstance throws System. NullRef
PHP install composer
Advanced API (character stream & net for beginners)
Recursion, Fibonacci sequence
dataworks自定義函數開發環境搭建
Win 2008 R2 crashed at the final installation stage
PAT甲级真题1166
4EVERLAND:IPFS 上的 Web3 开发者中心,部署了超过 30,000 个 Dapp!
mysql误删root账户导致无法登录