首页 > 编程语言 > 详细

把vue项目放到spring boot 下运行

时间:2021-01-05 15:12:33      阅读:445      评论:0      收藏:0      [点我收藏+]

设置路径

打开vue项目中的config/index.js文件 设置如下

有博客说assetspublicpath中设置为"/",自己测试不行,需要设置成"./"才不会报错

技术分享图片

把vue 项目打包成dist包

npm run build 生成dist包

导入到springBoot项目

在springboot 项目中resource文件下创建static 文件

把dist 解压的文件复制到static 下

技术分享图片

在application.properties 中配置路径

spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,  classpath:/static/,classpath:/public/,file:${web.upload-path}

index.html属于第一个static下的文件即/static/index.html

访问

http://127.0.0.1:8080/dist/index.html

 

把vue项目放到spring boot 下运行

原文:https://www.cnblogs.com/pijunqi/p/14235590.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!