【vue-admin-element】在侧边栏和主体部位之上添加区域

本文介绍了如何通过新建IndexNavTop页面、修改sidebar.scss和Navbar.vue来调整前端应用的头部、侧边栏和主体页面间距,实现界面的优化。步骤包括设置固定头部导航、侧边栏下移以及增加主体页面的margin-top,提升用户体验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在这里插入图片描述
第一步:新建IndexNavTop页面

<template>
  <div class="head">
    新添加的部分栏
  </div>
</template>
.head{
  margin: 0;
  padding: 0;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background-color: $--mainClor;
  display: flex;
  align-items: center;
  color: #fff;
  z-index: 999;
  position: fixed;
}

第二步:修改 sidebar.scss, 调整侧边栏位置

.sidebar-container {
    transition: width 0.28s;
    width: $sideBarWidth !important;
    background-color: $menuBg;
    height: 100%;
    position: fixed;
    font-size: 0px;
    /* 下移80px,这个根据自己导航的高度来的  */
    top:80px;
    bottom: 0;
    left: 0;
    z-index: 1001;
    overflow: hidden;	
    ....

第三步:修改Navbar.vue,调整主体页面上间距

.navbar {
    /* 添加一个margin-top  */
  margin-top: 80px;
  height: 50px;
  overflow: hidden;
  position: relative;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,21,41,.08);

第四步:页面组件引入并且挂载注册 layout\index.vue

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值