Composition-api: docs: How to access router (not route)

Created on 10 Aug 2020  路  2Comments  路  Source: nuxt-community/composition-api

I want to access the nuxt router. I try this by doing const { router } = useContext(), but to no avail.

馃攳 Where should you find it?
Probably on the useContext page?

documentation

Most helpful comment

In the Nuxt context, the router is within app. So, for example:

const { app: { router } } = useContext()

All 2 comments

In the Nuxt context, the router is within app. So, for example:

const { app: { router } } = useContext()

Thank you very much!!

Was this page helpful?
0 / 5 - 0 ratings