# 2 03.后台主布局实现

接上篇 动态页面标题实现，这里我们实现整个后台页面的布局

* #### 定义组件
  * * src/layouts/admin.vue
    * src/layouts/components/FHeader.vue
    * src/layouts/components/FMain.vue
    * src/layouts/components/FTagList.vue

```js
// 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>
```

```js
// 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>
```

* #### 修改路由

  > src/router/index.js

```js
// 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'} },
]
```

<div><img src="C:%5CUsers%5CAdministrator.DESKTOP-UK43ECI%5CAppData%5CRoaming%5Cmarktext%5Cimages%5C2023-02-20-15-24-52-image.png" alt=""> <img src="C:%5CUsers%5CAdministrator.DESKTOP-UK43ECI%5CAppData%5CRoaming%5Cmarktext%5Cimages%5C2023-02-20-15-27-19-image.png" alt=""> <figure><img src="https://2134947750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvILwbD2PrkBCkSitM3m4%2Fuploads%2FLXuhz5EJKxVKAoj0TvJ9%2F2023-02-20-15-24-52-image.png?alt=media&#x26;token=9c9a1f9a-da75-4eaa-b5a9-37a67202e37b" alt=""><figcaption></figcaption></figure></div>

<figure><img src="https://2134947750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvILwbD2PrkBCkSitM3m4%2Fuploads%2F7kfU4OX90jB99ex2NcC7%2F2023-02-20-15-27-19-image.png?alt=media&#x26;token=8fb97d8d-1164-43b1-9ca1-48b4b6bc72e8" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://close.gitbook.io/yun-wei-bi-ji/centos/vue/xiang-mu/2-03.-hou-tai-zhu-bu-ju-shi-xian.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
