vue打包後的dist整合到SpringBoot中

我的個人網站:
http://riun.xyz


1、修改vuejs的config/index.js,在裏面找到assetsPublicPath,改爲/dist/,記住,是build:{}這裏的,不是上面dev:{}的。

2、執行npm run build,會出現一個dist文件夾在vuejs項目目錄裏。

3、把這個dist文件夾copy到springboot的resources/static/,是整個dist連文件夾一起copy過來。如下圖
在這裏插入圖片描述

4、SpringBoot項目只需要parent依賴和web依賴即可。

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

5、啓動,訪問:http://localhost:8080/dist/index.html

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章