1. src 同级的 vue.config.js 中设置vue 没有就新建一个
// vue.config.js
module.exports = {
publicPath: './'
}
2.修改为 hash 路径
router 下 index.ts文件中 引入 createWebHashHistory
将 createWebHistory 替换为 createWebHashHistory
修改后为:
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
const router = createRouter({
history: createWebHashHistory(process.env.BASE_URL),
routes
})