Skip to content

Commit

Permalink
Finally understand routing somewhat!
Browse files Browse the repository at this point in the history
  • Loading branch information
zjf19002 committed Oct 10, 2023
1 parent 1791966 commit 8439e06
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion class_registration_app/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Home from './components/Home.vue'
</script>

<template>
<Home></Home>
<RouterView></RouterView>
</template>

<style scoped>
Expand Down
11 changes: 10 additions & 1 deletion class_registration_app/src/components/Home.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<script setup lang="ts">
import AppVue from '@/App.vue';
</script>

Expand All @@ -16,10 +19,16 @@
</div>

<div class="login">
<a href="/login"><button class="btn-97" style="position: absolute;top:42%;left:50%;transform:translate(-50%,-50%)">Login with your NetID here</button></a>
<a href="./login">
<button class="btn-97" style="position: absolute;top:42%;left:50%;transform:translate(-50%,-50%)">
Login with your netID here
</button>
</a>

<a style="position: absolute;top:80%;left:50%;transform:translate(-50%,-50%)">Forget your login?</a>
</div>
</div>

</template>

<style scoped>
Expand Down
1 change: 1 addition & 0 deletions class_registration_app/src/components/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<template>
<div>
<h1>Test!</h1>
<a href="/">Back</a>
</div>
</template>

Expand Down
7 changes: 4 additions & 3 deletions class_registration_app/src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import Home from '../components/Home.vue'
import Login from '../components/Login.vue'

const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'home',
component: HomeView
component: Home
},
{
path: '/login',
name: 'login',
// route level code-splitting
// this generates a separate chunk (About.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import('../views/LoginView.vue')
component: Login
}
]
})
Expand Down
1 change: 0 additions & 1 deletion class_registration_app/tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"playwright.config.*"
],
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["node"]
Expand Down
1 change: 0 additions & 1 deletion class_registration_app/tsconfig.vitest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "./tsconfig.app.json",
"exclude": [],
"compilerOptions": {
"composite": true,
"lib": [],
"types": ["node", "jsdom"]
}
Expand Down

0 comments on commit 8439e06

Please sign in to comment.