Skip to content

Commit e2a7afd

Browse files
committed
Add route questions
1 parent a46e0c4 commit e2a7afd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ List of 300 VueJS Interview Questions
226226
|217| [How to trigger watchers on initialization?](#how-to-trigger-watchers-on-initialization)|
227227
|218| [What is the purpose of comments option?](#what-is-the-purpose-of-comments-option)|
228228
|219| [How to identify whether code is running on client or server?](#how-to-identify-whether-code-is-running-on-client-or-server)|
229+
|220| [How do you watch route object changes?](#how-do-you-watch-route-object-changes)|
229230

230231
1. ### What is VueJS?
231232
**Vue.js** is an open-source, progressive Javascript framework for building user interfaces that aim to be incrementally adoptable. The core library of VueJS is focused on the `view layer` only, and is easy to pick up and integrate with other libraries or existing projects.
@@ -3973,4 +3974,13 @@ List of 300 VueJS Interview Questions
39733974
Vue.prototype.$isServer
39743975
(OR)
39753976
this.$isServer // With in component
3976-
```
3977+
```
3978+
220. ### How do you watch route object changes?
3979+
You can setup a watcher on the `$route` in your component. It observes for route changes and when changed ,sets the message property.
3980+
```javascript
3981+
watch:{
3982+
$route (to, from){
3983+
this.message = 'Welcome';
3984+
}
3985+
}
3986+
```

0 commit comments

Comments
 (0)