Vue发布Tomcat页面空白不显示内容

1.修改config/index.js

vue.config.js

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  publicPath:'./',
  assetsDir:'./'  // 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录。
})

2.修改src/router/index.js

export default new Router({
  //如打包文件存放在Tomcat/webapps/vue_test下,那么久这么写
  base: '/vue_test/',
  mode: 'history',
  routes: [
  	...
  ]
})

3.打包上传项目

输入网址查看

http://localhost:8080/vue_test/

在这里插入图片描述

4.文件夹(-R表示递归)

chmod -R 777 /tomcat
posted @ 2022-12-06 22:17  轻风细雨_林木木  阅读(15)  评论(0编辑  收藏  举报