How vue-router calls api? in history mode

call http://localhost:5438/api/change?id=123 to get data when you want to access http://localhost:8080/change/detail/123. The current configuration is as follows:

assetsPublicPath: "/",
proxyTable: {
      "/api": {
        target: "http://127.0.0.1:5438/api/",
        changeOrigin: true,
        pathRewrite: {
          "^/api": ""
        }
      }
    },

routing configuration is as follows

{
      path: "/change/detail/:id",
      name: "ChangeDetail",
      component: ChangeDetail
}
The code in

ChangeDetail is as follows

this.$axios.get("api/change?id=" + id)
          .then(response => {
            ......
          })

but after visiting, it is found that the url of the axios request is http://localhost:8080/change/detail/api/change?id=123 rather than http://localhost:8080/api/change?id=123
. How should I configure it? Thank you!

Apr.27,2021

axios: '/api/change?id=' + id .
Menu