修改路由

This commit is contained in:
luyuan 2020-09-25 16:27:33 +08:00
parent 011fa5337c
commit 10a0917cdc
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
4 changed files with 59 additions and 2 deletions

View File

@ -128,6 +128,7 @@ export default defineComponent({
name: string; name: string;
route: string; route: string;
} }
//
const list: Array<MenuItem> = [ const list: Array<MenuItem> = [
{ {
icon: "", icon: "",
@ -160,8 +161,13 @@ export default defineComponent({
route: "" route: ""
} }
] ]
// index
const selnum = ref(0); const selnum = ref(0);
const routeto = (index: number) => { /**
* 跳转路由与赋值对应的下标
* @param index 选中的下标 方便赋值与跳转
*/
function routeto(index: number): void {
console.log(index) console.log(index)
selnum.value = index; selnum.value = index;

40
src/layout/mine.vue Normal file
View File

@ -0,0 +1,40 @@
<template>
<div class="mine">
<NavTop style="flex-shrink:0"></NavTop>
<div class="body">
<Menu style="flex-shrink:0"></Menu>
<div class="container">
</div>
</div>
</div>
</template>
<style lang="scss" scoped>
.mine{
display: flex;
flex-direction: column;
.body{
display: flex;
.container{
width: 100%;
background-color: #F5F5F5;
padding: 23rpx;
}
}
}
</style>
<script lang="ts">
import { defineComponent } from 'vue';
import Menu from "@/components/Menu.vue";
import NavTop from "@/components/NavTop.vue"
export default defineComponent({
components:{
Menu,
NavTop
},
setup(){
console.log(1)
}
})
</script>

View File

@ -1,10 +1,21 @@
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router' import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
const routes: Array<RouteRecordRaw> = [ const routes: Array<RouteRecordRaw> = [
{
path:"/mine",
name:"Mine",
component: () => import("../layout/mine.vue"),
children: [
{
path:"Archives",
component: () => import("../views/mine/Archives.vue")
}
]
},
{ {
path: '/', path: '/',
name: 'Home', name: 'Home',
component: () => import(/* webpackChunkName: "about" */ '../components/Nav.vue') component: () => import(/* webpackChunkName: "about" */ '../components/NavTop.vue')
}, },
{ {
path: '/about', path: '/about',