How to get current route name in Nuxt 2 and 3?

yes you can use vuejs route objects like $route.name or $route.path

$nuxt.$route.path

return current path

$nuxt.$route.name

The name of the current route, if it has one.

Route Object Properties

A route object represents the state of the current active route. It
contains parsed information of the current URL and the route records
matched by the URL.

  • $route.path

    • type: string

    • A string that equals the path of the current route, always resolved as an absolute path. e.g. “/foo/bar”.

  • $route.fullPath

    • type: string

    • The full resolved URL including query and hash.

**

And if you want to get the url params. Like this :
enter image description here
You do this:

  data() {
    return {
       zone: this.$nuxt.$route.query.zone,
       jour: this.$nuxt.$route.query.jour

    }   },

**

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)