解决打包后资源找不到, 404 的问题
在vue.config.vue中添加
publicPath: './',
outputDir: 'dist',
assetsDir: 'static',
在路由index.js中添加 模式为 hash 模式
const router = createRouter({
mode:"hash",
history: createWebHistory(process.env.BASE_URL),
routes
})
解决打包后路由报错问题
在router.js中 修改顶部导入数据
import {createRouter,createWebHistory,createWebHashHistory} from 'vue-router'
const router = createRouter({
mode: "hash",
history: createWebHashHistory(),
routes
})
打包后接口数据后去不到的问题
将反向代理的目标地址改为空
补全请求地址即可