設置路徑
打開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