Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base route is appended to url on page referesh #103

Open
tkeer opened this issue Jun 2, 2021 · 1 comment
Open

base route is appended to url on page referesh #103

tkeer opened this issue Jun 2, 2021 · 1 comment

Comments

@tkeer
Copy link

tkeer commented Jun 2, 2021

With simple latest nuxt app, if you add @nuxtjs/router and set router base to anything, each browser refresh appends base route to the url.

image

package.json

  "name": "my-app",
  "scripts": {
    "dev": "nuxt",
  },
  "dependencies": {
    "nuxt": "^2.15.6"
  },
  "devDependencies": {
    "@nuxtjs/router": "1.6.1"
  }
}

nuxt.config.js

  ssr: false,

  router: {
    base: "/s"
  },


  buildModules: [
    "@nuxtjs/router",
  ],

};

router.js

import Vue from 'vue'
import Router from 'vue-router'

import MyPage from '~/my-page'

Vue.use(Router)

export function createRouter() {
  return new Router({
    mode: 'history',
    routes: [
      {
        path: '/',
        component: MyPage
      }
    ]
  })
}
@Lindar90
Copy link

I can confirm that this issue still exists. @tkeer I found a workaround, you need to use Vue Router's base property instead https://router.vuejs.org/api/#base

// in your router.js file:

const router = new Router({
    mode: 'history',

    base: '/app/',

    routes: [...]
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants