Browse Source

解决路由问题

神仙都没用 1 year ago
parent
commit
1ab8562123
2 changed files with 9 additions and 4 deletions
  1. 3 3
      src/cool/router/index.ts
  2. 6 1
      src/modules/base/pages/main/components/process.vue

+ 3 - 3
src/cool/router/index.ts

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

+ 6 - 1
src/modules/base/pages/main/components/process.vue

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