基于element-ui的侧边栏及其使用方法

该文介绍了如何基于Element-UI库创建一个具有侧边栏的Vue应用。侧边栏包含两个子菜单,分别用于攻略管理和发布攻略。样式设置使得侧边栏具有特定背景色和文字颜色。使用时需注意将侧边栏置于具有`container`样式的div内,以保证正常布局。

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

基于element-ui的侧边栏及其使用方法

基于element-ui的侧板栏。

效果展示

在这里插入图片描述

代码讲解

代码结构
在这里插入图片描述

<!-- TabbarLeftView.vue -->
<template>
  <el-aside width="200px">
    <el-menu
      default-active="1"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
      router
    >
      <el-submenu index="1">
        <template slot="title">攻略管理</template>
        <el-menu-item index="/">攻略列表</el-menu-item>
      </el-submenu>

      <el-submenu index="2">
        <template slot="title">发布攻略</template>
        <el-menu-item index="/orders">发布攻略</el-menu-item>
      </el-submenu>
    </el-menu>
  </el-aside>
</template>

<style>
.el-aside {
  background-color: #545c64;
  color: #fff;
  padding-top: 20px;
}
</style>

使用的时候需要注意,需要加上一个container属性的div,包裹,这样才可以正常布局。

.container {
  display: flex;
  height: 100vh;
}

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

极客李华

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值