From 6bebe5a9bbe1fec6ccbe76e171bab819e69be3f8 Mon Sep 17 00:00:00 2001
From: xiaosi <2652281683@qq.com>
Date: Mon, 27 Nov 2023 17:30:37 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=89=AA=E3=80=91=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/App.vue | 7 ++++---
src/layout/MainContainer.vue | 11 +++++++++++
src/router/index.js | 22 ++++++++++++++++++++++
src/views/LoginView/LoginView.vue | 13 +++++++++++++
4 files changed, 50 insertions(+), 3 deletions(-)
create mode 100644 src/layout/MainContainer.vue
create mode 100644 src/views/LoginView/LoginView.vue
diff --git a/src/App.vue b/src/App.vue
index 4c81e4b..9ecb801 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,15 +1,16 @@
diff --git a/src/layout/MainContainer.vue b/src/layout/MainContainer.vue
new file mode 100644
index 0000000..d2f5bf3
--- /dev/null
+++ b/src/layout/MainContainer.vue
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
diff --git a/src/router/index.js b/src/router/index.js
index d73877e..5cf5984 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,9 +1,18 @@
import { createRouter, createWebHistory } from 'vue-router';
+// import auth from '@/utils/auth';
const ExampleView = () => import('@/views/ExampleView/ExampleView.vue');
+const LoginView = () => import('@/views/LoginView/LoginView.vue');
const routes = [
+ {
+ path: '/',
+ redirect: () => '/login',
+ },
+
{ path: '/example', name: 'ExampleView', component: ExampleView },
+
+ { path: '/login', name: 'LoginView', component: LoginView },
];
const router = createRouter({
@@ -11,4 +20,17 @@ const router = createRouter({
routes,
});
+// 前置路由钩子
+// router.beforeEach((to, from, next) => {
+// // 必须先登录
+// if (!['LoginView'].includes(to.name) && !auth.checkToken()) {
+// return next({
+// name: 'LoginView',
+// replace: true,
+// });
+// }
+//
+// return next();
+// });
+
export default router;
diff --git a/src/views/LoginView/LoginView.vue b/src/views/LoginView/LoginView.vue
new file mode 100644
index 0000000..166dc65
--- /dev/null
+++ b/src/views/LoginView/LoginView.vue
@@ -0,0 +1,13 @@
+
+
+
+ LoginView
+
+
+