// src/layouts/admin.vue
<template>
<el-container>
<el-header>
<f-header/>
</el-header>
<el-container>
<el-aside>
<f-main/>
</el-aside>
<el-main>
<f-tag-list/>
<router-view></router-view>
</el-main>
</el-container>
</el-container>
</template>
<script setup>
import FHeader from './components/FHeader.vue';
import FMain from './components/FMain.vue';
import FTagList from './components/FTagList.vue';
</script>
// src/layouts/components/FHeader.vue
<template>
<div>
头部
</div>
</template>
// src/layouts/components/FMain.vue
<template>
<div>
主体
</div>
</template>
// src/layouts/components/FTagList.vue
<template>
<div>
标签
</div>
</template>ate>
// 2.定义一些路由
const routes = [
{
path: "/",
component: Admin,
children:[{
path: "/",
component: Index,
meta: { 'title': '首页' }
}]
},
{ path: "/about", component: About, name: "about", meta: {'title': '关于'}},
{ path: "/login", component: Login, name: "login", meta: {'title': '登录'}},
{ path: '/:pathMatch(.*)*', name: 'NotFound', component: NotFound, meta: {'title': '404'} },
]