When using vue/vue-router, I have set up a watcher on $route
that is triggered in two different ways:
- By clicking back or forward on the browser.
- When the user interacts with a form. There are watchers on the variables that the form uses, and these watchers update the URL using
$router.push
.
Within the watcher function for $route
, how can I determine which of the two scenarios mentioned above has occurred?
The challenge lies in distinguishing between scenario 1 and scenario 2. If scenario 1 takes place, I need to manually update the form again. However, if scenario 2 happened, the form will already have been updated, so manual intervention is not necessary.