在 搭建项目前篇中提到,没有接口就先做首页,有接口就尽量从登录页面开始做。这一步。我到了首页界面的搭建
应用到element中的布局容器组件
首页布局
<el-container>
//头部导航
<el-header class="nav">
<el-image :src="img" class="avatarImg" :fit="fit" ></el-image>
<span class="pStyle">后台管理系统</span>
<el-button @click="logout" class="logoutBtn">退出登录</el-button>
</el-header>
<el-container>
// 侧边栏
<el-aside width="200px">Aside</el-aside>
<el-container>
//内容区
<el-main>Main</el-main>
</el-container>
</el-container>
</el-container>
逻辑中需要实现退出功能
//实现退出功能
logout() {
//清除token
window.sessionStorage.clear()
// 退出到登录界面
this.$router.push('/login')
},
本文档介绍了如何运用Element UI的布局容器组件来搭建后台管理系统的首页,包括头部导航、侧边栏和内容区的实现。同时,详细阐述了如何在逻辑中实现退出登录功能,通过清除sessionStorage中的token并跳转至登录页面来完成这一操作。
177

被折叠的 条评论
为什么被折叠?



