Skip to content

Commit

Permalink
嵌套路由
Browse files Browse the repository at this point in the history
  • Loading branch information
dian-yu-luo committed Jun 8, 2023
1 parent ee3fc3e commit 92b3bb7
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/router/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import {createRouter, createWebHistory} from 'vue-router'
import HomeView from '../views/HomeView.vue'
import repeatWord from "@/components/RepeatWord.vue";
import repeatMain from "@/views/repeat/RepeatMain.vue";
import mainPage from "@/views/demodir/MainPage.vue";

const routes = [
{
path: '/',
name: 'home',
component: HomeView
path: "/",
component: repeatMain,
children: []
},
{
path: "/main",
component: mainPage,
children: []

},
{
path: '/about',
name: 'about',
component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
component: () => import(/* webpackChunkName: "about" */ '../views/repeat/AboutView.vue')
}, {
path: "/repeatword",
component: repeatWord
Expand Down
17 changes: 17 additions & 0 deletions src/views/demodir/HomeView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script setup>
</script>

<template>
<div>
demo howmview
</div>
</template>
<script>
export default {
name:"HomeView"
}
</script>
<style scoped>
</style>
12 changes: 12 additions & 0 deletions src/views/demodir/MainPage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script setup>
</script>

<template>
<router-view></router-view>
</template>
<script>
export default {}
</script>
<style scoped>
</style>
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions src/views/repeat/RepeatMain.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<script setup>
import SidebarView from "@/views/repeat/SidebarView.vue";
import HeaderView from "@/views/repeat/HeaderView.vue";
</script>

<template>
<a-layout>
<a-layout-sider><sidebar-view></sidebar-view></a-layout-sider>
<a-layout>
<a-layout-header><header-view></header-view></a-layout-header>
<a-layout-content></a-layout-content>
<a-layout-footer>4</a-layout-footer>
</a-layout>
</a-layout>
</template>
<script>
export default {}
</script>

<style scoped>
</style>
File renamed without changes.

0 comments on commit 92b3bb7

Please sign in to comment.