Ver Fonte

admin-2025-02-16 02:51:45

genlitex há 2 meses atrás
pai
commit
80cc450702
4 ficheiros alterados com 32 adições e 3 exclusões
  1. 13 0
      components.d.ts
  2. 1 1
      src/main.js
  3. 5 0
      src/router/index.js
  4. 13 2
      src/views/HomeView.vue

+ 13 - 0
components.d.ts

@@ -0,0 +1,13 @@
+/* eslint-disable */
+// @ts-nocheck
+// Generated by unplugin-vue-components
+// Read more: https://github.com/vuejs/core/pull/3399
+export {}
+
+/* prettier-ignore */
+declare module 'vue' {
+  export interface GlobalComponents {
+    RouterLink: typeof import('vue-router')['RouterLink']
+    RouterView: typeof import('vue-router')['RouterView']
+  }
+}

+ 1 - 1
src/main.js

@@ -3,4 +3,4 @@ import { createApp } from 'vue'
 import App from './App.vue'
 import router from './router'
 
-createApp(App).use(router).use(router).mount('#app')
+createApp(App).use(router).mount('#app')

+ 5 - 0
src/router/index.js

@@ -16,6 +16,11 @@ const routes = [
     // component: function () {
     //   return import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
     // }
+  },
+  {
+    path: '/login',
+    name: 'login',
+    component: () => import('../views/LoginView.vue')
   }
 ]
 

+ 13 - 2
src/views/HomeView.vue

@@ -1,13 +1,20 @@
 <template>
   <div class="home">
     <h2>欢迎使用Prototype Design, 请您根据您的需要设计您的Prototype</h2>
+    <a-button type="primary" @click="goToLogin" class="center-button">Go To Login</a-button>
   </div>
 </template>
 
-<script>
+<script setup>
+import { useRouter } from 'vue-router';
 
-export default {}
+const router = useRouter();
+
+function goToLogin() {
+  router.push({ name: 'login' });
+}
 </script>
+
 <style>
 .home {
   height: 100vh;
@@ -16,4 +23,8 @@ export default {}
   justify-content: center;
   align-items: center;
 }
+
+.center-button {
+  margin-top: 10px;
+}
 </style>