Help! @Watch can not watch '$router' in Typecript
See original GitHub issue @Watch('id')
public getLinksFromRoute (val: any, old: any) {
console.log(1); // worked
}
@Watch('$route')
public getLinksFromRoute (val: Route, old: Route) {
console.log(1); // not worked
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Watch('$router') is not fired and throws exception
I'm diving deeper into Vue + Typescript. It was fine until I faced an issue with router. My app structure is:.
Read more >Getting Started with React Router 6 and Typescript [2022]
React router 5 was awesome, and react router 6 is even better!Commands used:create-react-app react- router -6 --template=typescriptnpm install ...
Read more >Building a Web app with Vue Router, Typescript ... - YouTube
Today we will be looking at using Vue Router with the composition API, to create a cat facts webpage with full typescript support....
Read more >TypeScript support in Svelte - Learn web development
In this article we took our to-do list application and ported it to TypeScript.
Read more >next/router | Next.js
If you want to access the router object inside any function component in your app, you can use the useRouter hook, take a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Watch(‘$route’, { immediate: true, deep: true } ) onRouteChange (to: any, from: any) { console.log(to) this.photoId = to.params.id }
@CloseGillter47 It works if ‘deep’ is set to true.
@Watch('$route', {deep: true})
@foxbunny What is recommended way to react to route changes?