1. npm run build生成打包文件在項目dist目錄中
2. 復制dist目錄內內容至Tomcat服務器webapps/ROOT文件夾下(無ROOT文件夾則創建)
3. 在Tomcat conf文件下編輯web.xml,文件尾部添加:
... <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> </welcome-file-list> <error-page> <error-code>404</error-code> <location>/index.html</location> </error-page> </web-app>
4. 啟動Tomcat, 瀏覽器輸入localhost:8080即可訪問