1.修改vuejs的config/index.js,在里面找到assetsPublicPath,改为/,记住,是build:{}这里的,不是上面dev:{}的

build: {
    // Template for index.html
    index: path.resolve(__dirname, '../dist/index.html'),

    // Paths
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',

2. springboot的resources下创建static文件夹,把vue打包出来的static和index.html放进去

3.添加pom

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

4.访问静态资源

#访问静态资源
server.resources.static-locations=classpath:/resources/,classpath:/static/
spring.thymeleaf.prefix=classpath:/static

5. 访问:http://localhost:8080/index.html

........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Logo

前往低代码交流专区

更多推荐