第一次尝试将各个url分开访问

This commit is contained in:
MiLla 2024-06-24 17:15:21 +08:00
parent e8e794e9d4
commit b9c8842a85
7 changed files with 56 additions and 26 deletions

2
package-lock.json generated
View File

@ -1285,7 +1285,7 @@
}, },
"node_modules/vue-router": { "node_modules/vue-router": {
"version": "4.4.0", "version": "4.4.0",
"resolved": "https://registry.npmmirror.com/vue-router/-/vue-router-4.4.0.tgz", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.4.0.tgz",
"integrity": "sha512-HB+t2p611aIZraV2aPSRNXf0Z/oLZFrlygJm+sZbdJaW6lcFqEDQwnzUBXn+DApw+/QzDU/I9TeWx9izEjTmsA==", "integrity": "sha512-HB+t2p611aIZraV2aPSRNXf0Z/oLZFrlygJm+sZbdJaW6lcFqEDQwnzUBXn+DApw+/QzDU/I9TeWx9izEjTmsA==",
"dependencies": { "dependencies": {
"@vue/devtools-api": "^6.5.1" "@vue/devtools-api": "^6.5.1"

View File

@ -9,10 +9,10 @@
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"axios": "^1.7.2",
"element-plus": "^2.7.6", "element-plus": "^2.7.6",
"vue": "^3.4.29", "vue": "^3.4.29",
"vue-router": "^4.4.0", "vue-router": "^4.4.0",
"axios": "^1.7.2",
"vuex": "^4.1.0" "vuex": "^4.1.0"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,30 +1,39 @@
<script setup> <script setup>
import HelloWorld from './components/HelloWorld.vue' import HelloWorld from './components/HelloWorld.vue'
import authentication from "./components/authentication.vue";
</script> </script>
<template> <template>
<div> <div id="app">
<a href="https://vitejs.dev" target="_blank"> <router-view v-if="isHelloRoute"><HelloWorld/></router-view>
<img src="/vite.svg" class="logo" alt="Vite logo" /> <router-view v-if="isAuthenRoute"><authentication/></router-view>
</a>
<a href="https://vuejs.org/" target="_blank">
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
</a>
</div> </div>
<HelloWorld msg="Vite + Vue" />
</template> </template>
<style scoped> <script>
.logo { export default {
height: 6em; name: 'App',
padding: 1.5em; computed: {
will-change: filter; isHelloRoute() {
transition: filter 300ms; return this.$route.path === '/about'; //
} },
.logo:hover { isAuthenRoute() {
filter: drop-shadow(0 0 2em #646cffaa); return this.$route.path === '/login'; //
} }
.logo.vue:hover { }
filter: drop-shadow(0 0 2em #42b883aa); };
} </script>
</style> <!--<style scoped>-->
<!--.logo {-->
<!-- height: 6em;-->
<!-- padding: 1.5em;-->
<!-- will-change: filter;-->
<!-- transition: filter 300ms;-->
<!--}-->
<!--.logo:hover {-->
<!-- filter: drop-shadow(0 0 2em #646cffaa);-->
<!--}-->
<!--.logo.vue:hover {-->
<!-- filter: drop-shadow(0 0 2em #42b883aa);-->
<!--}-->
<!--</style>-->

View File

@ -13,8 +13,9 @@ const count = ref(0)
<template> <template>
<h1>{{ msg }}</h1> <h1>{{ msg }}</h1>
<div class="card"> <div class="card">
<el-button type="success" @click="count++">count is {{ count }}</el-button> <el-button type="danger" @click="count++">count is {{ count }}</el-button>
<p> <p>
Edit Edit
<code>components/HelloWorld.vue</code> to test HMR <code>components/HelloWorld.vue</code> to test HMR

View File

@ -0,0 +1,13 @@
<script setup>
</script>
<template>
<h1>登录</h1>
<el-input >pls enter the username</el-input>
<el-input>pls enter the username</el-input>
</template>
<style scoped>
</style>

View File

@ -6,9 +6,11 @@ import meetingManagementRoutes from './meetingManagement'
import newsManagementRoutes from './newsManagement' import newsManagementRoutes from './newsManagement'
import organizationManagementRoutes from './organizationManagement' import organizationManagementRoutes from './organizationManagement'
import userManagementRoutes from './userManagement' import userManagementRoutes from './userManagement'
import authentication from "../components/authentication.vue";
const routes = [ const routes = [
{ path: '/', component: HelloWorld }, { path: '/about', component: HelloWorld },
{ path: '/login', component: authentication},
...authenticationRoutes, ...authenticationRoutes,
...courseManagementRoutes, ...courseManagementRoutes,
...meetingManagementRoutes, ...meetingManagementRoutes,

View File

@ -0,0 +1,5 @@
import { createApp } from 'vue';
import App from '../App.vue';
import router from '../router';
createApp(App).use(router).mount('#app');