1,修改vue一些默认配置
修改路由配置
找到router/index.js文件夹,修改路由历史模式为hash
const router = createRouter({
history: createWebHashHistory(),
routes
})
添加打包配置文件vue.config.js
const {defineConfig}=require('@vue/cli-service')
//打包配置文件
module.exports = defineConfig({
transpileDependencies:true,
// assetsDir: 'static',
// parallel: false,
publicPath: './',
});
2,打包部署到tomcat
修改配置后,保存运行npm run build进行打包,打包完成生成dist文件夹。
复制dist文件夹到D:\apache-tomcat-8.5.87-windows-x64\apache-tomcat-8.5.87\webapps,将dist文件夹复制到tomcat的webapps下,启动tomcat即可访问。