当前位置: 首页 > news >正文

第73左侧菜单实现

layout下面新建menu

在这里插入图片描述

layout index.vue导入menu

import Menu from '@/views/layout/menu'

在这里插入图片描述
菜单实现:

<template>
  <el-menu
      active-text-color="#ffd04b"
      background-color="#2d3a4b"
      class="el-menu-vertical-demo"
      default-active="home"
      text-color="#fff"
      router
  >
    <el-menu-item index="home">
      <el-icon><home-filled /></el-icon>
      <span>首页</span>
    </el-menu-item>

    <el-menu-item index="user">
      <el-icon><user /></el-icon>
      <span>用户管理</span>
    </el-menu-item>

    <el-sub-menu index="3">
      <template #title >
        <el-icon><management /></el-icon>
        <span>商品类别管理</span>
      </template>
      <el-menu-item index="bigType">
        <el-icon><management /></el-icon>
        <span>商品大类管理</span>
      </el-menu-item>
      <el-menu-item index="smallType">
        <el-icon><management /></el-icon>
        <span>商品小类管理</span>
      </el-menu-item>
    </el-sub-menu>

    <el-menu-item index="product">
      <el-icon><tickets /></el-icon>
      <span>商品管理</span>
    </el-menu-item>

    <el-menu-item index="order">
      <el-icon><tickets /></el-icon>
      <span>订单管理</span>
    </el-menu-item>

    <el-sub-menu index="11">
      <template #title >
        <el-icon><management /></el-icon>
        <span>系统管理</span>
      </template>
      <el-menu-item index="modifyPassword">
        <el-icon><edit /></el-icon>
        <span>修改密码</span>
      </el-menu-item>
      <el-menu-item >
        <el-icon @click="logout"><switch-button /></el-icon>
        <span @click="logout">安全退出</span>
      </el-menu-item>
    </el-sub-menu>
  </el-menu>
</template>

<script setup>
import {HomeFilled,User,Tickets,Goods,DocumentAdd,Management,Setting,Edit,SwitchButton} from '@element-plus/icons-vue'

</script>

<style lang="scss" scoped>

</style>

layout修改:

<template>
  <div class="app-wrapper">
    <el-container>
      <el-aside width="200px" class="sidebar-container"><Menu/></el-aside>
      <el-container>
        <el-header>Header</el-header>
        <el-main>Main</el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup>
import Menu from '@/views/layout/menu'
</script>

<style lang="scss" scoped>

.app-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.sidebar-container {
  background-color: #2d3a4b;
  height: 100%;
}

::v-deep .el-container{
  height: 100%;
}

</style>

在这里插入图片描述

相关文章:

  • 【NI-DAQmx入门】调整数据记录长度再进行数据处理
  • 第二节 zookeeper基础应用与实战
  • 多维时序 | Matlab实现TCN-RVM时间卷积神经网络结合相关向量机多变量时间序列预测
  • C 语言 devc++ 使用 winsock 实现 windows UDP 局域网发送消息
  • 设计模式之结构型模式
  • 通过 Prometheus 编写 TiDB 巡检脚本(脚本已开源,内附链接)
  • TCP/IP C 语言实现单个客户端和服务端 TCP 通信
  • 【FPGA开发】HDMI通信协议解析及FPGA实现
  • HiveSQL——共同使用ip的用户检测问题【自关联问题】
  • CVE-2022-25487 漏洞复现
  • 排序算法---计数排序
  • 安全基础~通用漏洞5
  • 【Spring2】从重构HelloWorld看Spring的作用
  • 面试经典150题——最小覆盖子串(困难)
  • 微信小程序(四十一)wechat-http的使用
  • Java解决下降路径最小和
  • C++数据结构与算法——双指针法
  • BatchNorm介绍:卷积神经网络中的BN
  • 鸿蒙系统优缺点,能否作为开发者选择
  • MySQL 基础知识(八)之用户权限管理
  • 摩天大楼天津117大厦复工背后:停工近十年,未知挑战和压力仍在
  • 中国证券监督管理委员会党委委员、副主席王建军接受审查调查
  • 金砖国家外长会晤落幕,外交部:发出了反对单边霸凌行径的“金砖声音”
  • 笔墨如何“构城”?上海美院城市山水晋京展出
  • 中国体育报关注徐梦桃、王曼昱、盛李豪等获评全国先进工作者:为建设体育强国再立新功
  • 湖南华容县通报“大垱湖水质受污染”,爆料者:现场已在灌清水