In this lesson we learn how to access the Vue Router route
and router
objects from inside the setup function. Since setup() is called before other component options are resolved the this
keyword does not reference the component instance as it does within the Options API. Therefore we can use composables provided by Vue Router to access route
and router
. This is a common pattern utilized by third party libraries to integrate with the composition API.
Links