H5 页面刷新404
2023-07-28 16:07 法子 阅读(149) 评论(0) 编辑 收藏 举报参考:https://blog.csdn.net/weixin_44917334/article/details/129387658
history 模式由createWebHistory改为createWebHashHistory
import { createRouter, createWebHistory,createWebHashHistory } from 'vue-router' import HomeView from '../views/HomeView.vue' import LoginView from '../views/LoginView.vue' const router = createRouter({ history: createWebHashHistory(import.meta.env.BASE_URL), routes: [ { path: '/', name: 'home', component: HomeView, meta: { title: '首页' } }, { path: '/login', name: 'login', component: LoginView, meta: { title: '登录' } } ] })