Vue router uses history mode to refresh error with parameter url

mode uses history
nginx configuration / project {

try_files ...

}
router configuration
{path:"/ project/", component: HomeInfo},
{path:"/ project/home", component: HomeInfo},
{path:"/ project/:id", component: HomeInfo}

visit http://localhost:8080/project/ normal
visit http://localhost:8080/project/home normal
visit http://localhost:8080/project/home/1 error (main.c53f5dc62e2668d28730.js:1 Uncaught SyntaxError: Unexpected token <)
http://localhost:8080/project/home/1 is normal if it is routed in. But share this page and report an error as soon as you enter it, or refresh it and report an error

how to solve

Apr.07,2021

I encountered the same problem. I changed config/index.js
clipboard.png
to assetsPublicPath:'/ 'under build, and solved the


address access problem. My solution is to introduce static files under index.html without adding'. / static' directly'/ static'


report an error through the shared link, probably because ios does not support pushstate, routing changes will not change url, can check whether the shared link is correct

Menu