See if your Vue routing mode is history or hash
1. First change the publicPath under vue.config.js to './'
2. Change the process.env.NODE_ENV under main.js to ===development
if If it is history mode, it needs to cooperate with the backend.
For example, the backend gives you an address that needs to be accessed: /aaa/ Then you modify it under router.js new Router()
const createRouter = () =>
new Router({
mode: 'history', // require service support
base:'/aaa/',//这是history的路由模式进行添加base 内容和服务器端保持一致
scrollBehavior: () => ({
y: 0 }),
routes: constantRoutes,
});
const router = createRouter();
Then modify the publicPath in vue.config.js
and then ask if there is a problem with the access address of the backend. Find the responsibility of the backend.