其实方法很简单的,比直接放到tomacat时需要改动assetsPublicPath还简单。。。

 

直接打包,把dist目录下内容全部拷贝到springboot工程目录下的main\resources\static目录下

 

我这里是thymeleaf,使用的是templates下的模板

@Controller
public class pageController {
    @RequestMapping("/")
    public String index() {
        return "index";
    }
}

跳转到了templates下的index.html

 

所以我们在该index.html下用代码跳转到static下的index.html

<!DOCTYPE html>
<html>
<script>
   location.href = "index.html"
</script>
<body>
</body>
</html>

 

行了,启动springboot项目,然后浏览器输入:http://127.0.0.1:8080/

自动跳转为:http://127.0.0.1:8080/index.html#/

效果就出来了

Logo

Vue社区为您提供最前沿的新闻资讯和知识内容

更多推荐