D
D
Dmitry Baskakov2020-02-05 05:39:31
Vue.js
Dmitry Baskakov, 2020-02-05 05:39:31

Why is vue js route not working?

Routes:

const routes = [
  {
    path: '/',
    name: 'home',
    component: Home
  },
  {
    path: '/report/:key',
    name: 'reportDialog',
    component: ReportDialog
  }
]


When I go to the desired address, the home page template (Home) opens, instead of the desired one (ReportDialog). What could be the problem?
http://localhost:8080/report/f7f0833d7ace1e53f1391f0f204dd68f366c79092248a5dca13e019da2dd5083#/


I don’t know if it will be useful, but here is vue.config.js

// vue.config.js
module.exports = {
    devServer: {
        proxy: {
            '^/api/': {
                target: 'http://backend.loc/',
                changeOrigin: true // so CORS doesn't bite us.
            },
            '^/api-assets/': {
                target: 'http://backend.loc/',
                changeOrigin: true // so CORS doesn't bite us.
            }
        }
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2020-02-05
@dmitrybascacov

When creating a mode router , specify 'history', or follow the link:

http://localhost:8080/#/report/f7f0833d7ace1e53f1391f0f204dd68f366c79092248a5dca13e019da2dd5083/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question