1

i'm using router.push to change the route,it works,but:

router.push({path:'xxx'}

the result in my browser shows that, this is a '#(hash) mode push', the address look like:

localhost:8080/index/xxx#

how can i make a push without #(hash),like this:

localhost:8080/index/xxx

i have already set mode:'history' in 'router.js'

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

sorry my bad English

here is my code:

methods: {

changeIdx (item) {

    console.log(
        this.currentURL.slice(0, this.currentURL.lastIndexOf('/') + 1) + this.urlStore[item]
    )

    this.$router.push(
        this.currentURL.slice(0, this.currentURL.lastIndexOf('/') + 1) + this.urlStore[item]
    )

}

in console: console.log

in browser: address in browser

  • That seems like a bug in your code. Can you create a fiddle in [codesandbox](https://codesandbox.io/s/vue) to reproduce the issue? – tony19 Sep 24 '18 at 07:49
  • Duplicate of https://stackoverflow.com/questions/34623833/how-to-remove-hashbang-from-url – Thomas Lombart Sep 24 '18 at 07:49

0 Answers0