1

I'm having some "issues" with a project in Nuxt.js. I have created three pages: register.vue, login.vue and index.vue.

I was trying to do some functions with middleware in order to redirect between views in case that one user was logged in or not.

The thing is that i realized that in the browser, the 'register' page router shows like: localhost:xx/register/ and the login and index pages routes shows like: localhost:xx/login and localhost:xx/

The problem is why it appears a trailing slash in the register view and no in the others.

I have tried the:

trailingSlash: false

in the nuxt.config.js, and although it quits the trailing slash from the url, if I use the command:

$nuxt.$route.path

for obtaining the path, it still remains with the '/' in the case of the register view.

Any idea about this? Any help will be appreciated!!

kissu
  • 40,416
  • 14
  • 65
  • 133
Javi Martínez
  • 368
  • 1
  • 4
  • 16

1 Answers1

0

With this kind of code, this is properly displaying the route path

<script>
export default {
  fetch({ route }) {
    console.log(route.path)
  },
}
</script>

enter image description here

PS: I do also have trailingSlash: false.

kissu
  • 40,416
  • 14
  • 65
  • 133