解决路由问题

This commit is contained in:
神仙都没用 2023-12-15 16:33:53 +08:00
parent c8582a7547
commit 1ab8562123
2 changed files with 9 additions and 4 deletions

View File

@ -18,7 +18,8 @@ const routes: RouteRecordRaw[] = [
children: [] children: []
}, },
{ {
path: "/:pathMatch(.*)*", path: "/:catchAll(.*)",
name: "404",
component: () => import("/$/base/pages/error/404.vue") component: () => import("/$/base/pages/error/404.vue")
} }
]; ];
@ -174,9 +175,8 @@ router.beforeEach(async (to, from, next) => {
if (!route?.components) { if (!route?.components) {
next(user.token ? "/404" : "/login"); next(user.token ? "/404" : "/login");
} else { } else {
// 注册后重定向
if (!isReg) { if (!isReg) {
next({ ...to, ...route }); next(to.fullPath);
} else { } else {
// 登录成功 // 登录成功
if (user.token) { if (user.token) {

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="app-process"> <div class="app-process">
<ul class="app-process__op"> <ul class="app-process__op">
<li class="item" @click="router.back"> <li class="item" @click="toBack">
<i class="cl-iconfont cl-icon-back"></i> <i class="cl-iconfont cl-icon-back"></i>
</li> </li>
<li class="item" @click="toRefresh"> <li class="item" @click="toRefresh">
@ -55,6 +55,11 @@ function toHome() {
router.push("/"); router.push("/");
} }
//
function toBack() {
router.back();
}
// //
function toPath() { function toPath() {
const d = process.list.find((e) => e.active); const d = process.list.find((e) => e.active);