How to solve the problem of incorrect default route after packaging and deployment of vue project
This article introduces the relevant knowledge of "how to solve the incorrect default route after the vue project is packaged and deployed". In the operation of the actual case, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Problem description of incorrect default route after package deployment
The default route is fine when the vue project is developed locally, for example
Redirect: "/ index"
However, after deployment, the default route on the server is incorrect, and the problem now is that it will jump to the login page by default, provided that the project does not have routing permission.
Solution
Open the routing index.js file and add: base: "/"
Const routers = new Router ({mode: "history", base: "/"})
Package and publish to the server again and find that the problem is solved.
The path of vue is incorrect after packing.
1. View the scripts command of package.json file
2. Open the webpack.dev.conf.js file, find publicPath: config.dev.assetsPublicPath, press Ctrl and click to jump to the index.js file.
3. Where dev is the development environment and build is the construction version, find the assetsPublicPath:'/ 'under build, and then change it to assetsPublicPath:'. /', that is, add a point before "/".
4. The terminal can run npm run build.
For the problem that the background picture is not displayed
Project directory > build folder > utils.js
The animation cannot be run
Vue-cli scaffolding package.json profile
"browserslist": ["> 1%", "last 5 versions", "Android > = 4.0", "not ie"