1. Install tomcat
Download and install Tomcat to see this
2. Create the vue.config.js file
Create a file in the project root directory and name it vue.config.js
3. Write the content of vue.config.js
//部署上线的配置
module.exports = {
outputDir : 'competition',//打包后的文件夹名,默认disk
assetsDir : './src/assets',//静态文件的目录(如照片)
publicPath : '',//公共路径
}
4. Modify the routing method of src/router/index.js
The history method requires additional configuration on the server, but not for hash
5. src/router/index.js adds an empty path jump, that is, access to the project default jump to the login interface (or home page)
6. Package deployment
The result of running the command npm run build
: The package file name set in the previous vue.config.js file is generated in the project root directory
7. Put the generated folder into the webapp directory under Tomcat of the server
8. Visit http://xxx (domain name or IP address): xxx (port number)/xxx packaged folder name
For example: http://127.0.0.1:8080/competition
access automatically jumps to the login interface/home page