vuejs3+elementPlus后台管理系统,左侧菜单栏制作,跳转、默认激活菜单

默认激活菜单,效果: 

默认激活菜单,效果1:

默认激活菜单,效果2:

跳转链接效果:

制作:

<script setup>
import {useUserStore} from "@/stores/userStore.js";
import {ref} from "vue";

const userStore = useUserStore()
//默认激活菜单
const defaultMenu = ref('/home')
</script>

<template>
  <el-menu
      active-text-color="#409EFF"
      background-color="#32363f"
      :default-active="defaultMenu"
      text-color="#fff"
      @open="handleOpen"
      @close="handleClose"
      router
  >
    <el-sub-menu :index="ind+1" v-for="(menuItem,ind) in userStore.userInfo.menus" :id="menuItem.id">
      <template #title>
        <el-icon>
          <component :is="menuItem.icon"></component>
        </el-icon>
        <span>{{menuItem.name}}</span>
      </template>
      <el-menu-item :index="childItem.frontpath" v-for="(childItem,childInd ) in menuItem.child">
        <template #title>
          <el-icon>
            <component :is="childItem.icon"></component>
          </el-icon>
          <span>{{childItem.name}}</span>
        </template>
      </el-menu-item>

    </el-sub-menu>


  </el-menu>
</template>

<style scoped>

</style>

代码解析,实现路径跳转:

代码解析,默认激活菜单

数据格式:

{
    "status": 200,
    "id": 3,
    "username": "admin",
    "avatar": "http:xxxxxxxxxxx.com/public/642438a225ad5.jpg",
    "super": 1,
    "role": {
        "id": 2,
        "name": "超级管理员"
    },
    "menus": [
        {
            "id": 598,
            "rule_id": 0,
            "status": 1,
            "create_time": "2024-06-11 23:22:32",
            "update_time": "2024-06-19 22:32:52",
            "name": "后台首页",
            "desc": null,
            "frontpath": "",
            "condition": "",
            "menu": 1,
            "order": 1,
            "icon": "House",
            "method": "",
            "child": [
                {
                    "id": 599,
                    "rule_id": 598,
                    "status": 1,
                    "create_time": "2024-06-11 23:24:51",
                    "update_time": "2024-06-19 22:32:55",
                    "name": "后台首页",
                    "desc": null,
                    "frontpath": "/home",
                    "condition": "",
                    "menu": 1,
                    "order": 50,
                    "icon": "AddLocation",
                    "method": "",
                    "child": []
                }
            ]
        },
        {
            "id": 562,
            "rule_id": 0,
            "status": 1,
            "create_time": "2024-05-29 21:18:00",
            "update_time": "2024-06-11 23:19:37",
            "name": "图库管理",
            "desc": null,
            "frontpath": "",
            "condition": "调度",
            "menu": 1,
            "order": 2,
            "icon": "Opportunity",
            "method": "POST",
            "child": [
                {
                    "id": 563,
                    "rule_id": 562,
                    "status": 1,
                    "create_time": "2024-05-29 21:19:18",
                    "update_time": "2024-05-30 14:17:37",
                    "name": "图库管理",
                    "desc": null,
                    "frontpath": "/image/list",
                    "condition": "",
                    "menu": 1,
                    "order": 2,
                    "icon": "PictureFilled",
                    "method": "",
                    "child": [
                        {
                            "id": 571,
                            "rule_id": 563,
                            "status": 1,
                            "create_time": "2024-05-30 14:16:47",
                            "update_time": "2024-05-30 14:16:47",
                            "name": "11",
                            "desc": null,
                            "frontpath": "11",
                            "condition": "",
                            "menu": 1,
                            "order": 50,
                            "icon": "AddLocation",
                            "method": "",
                            "child": [
                                {
                                    "id": 597,
                                    "rule_id": 571,
                                    "status": 1,
                                    "create_time": "2024-06-11 17:06:34",
                                    "update_time": "2024-06-11 17:06:34",
                                    "name": "图库",
                                    "desc": null,
                                    "frontpath": "",
                                    "condition": "",
                                    "menu": 1,
                                    "order": 50,
                                    "icon": "AlarmClock",
                                    "method": "",
                                    "child": []
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        {
            "id": 556,
            "rule_id": 0,
            "status": 1,
            "create_time": "2024-05-29 18:35:06",
            "update_time": "2024-05-30 16:45:55",
            "name": "管理员管理",
            "desc": null,
            "frontpath": "",
            "condition": "",
            "menu": 1,
            "order": 3,
            "icon": "Avatar",
            "method": "",
            "child": [
                {
                    "id": 557,
                    "rule_id": 556,
                    "status": 1,
                    "create_time": "2024-05-29 18:36:05",
                    "update_time": "2024-05-30 16:45:54",
                    "name": "管理员管理",
                    "desc": null,
                    "frontpath": "/manager/list",
                    "condition": "",
                    "menu": 1,
                    "order": 50,
                    "icon": "AddLocation",
                    "method": "",
                    "child": []
                },
                {
                    "id": 558,
                    "rule_id": 556,
                    "status": 1,
                    "create_time": "2024-05-29 18:37:14",
                    "update_time": "2024-06-06 14:42:46",
                    "name": "权限管理",
                    "desc": null,
                    "frontpath": "/access/list",
                    "condition": "",
                    "menu": 1,
                    "order": 50,
                    "icon": "AlarmClock",
                    "method": "",
                    "child": []
                },
                {
                    "id": 587,
                    "rule_id": 556,
                    "status": 1,
                    "create_time": "2024-05-30 16:32:43",
                    "update_time": "2024-06-06 14:42:50",
                    "name": "角色管理",
                    "desc": null,
                    "frontpath": "/role/list",
                    "condition": "",
                    "menu": 1,
                    "order": 50,
                    "icon": "AddLocation",
                    "method": "",
                    "child": []
                }
            ]
        },
        {
            "id": 574,
            "rule_id": 0,
            "status": 1,
            "create_time": "2024-05-30 14:29:44",
            "update_time": "2024-05-30 17:25:32",
            "name": "用户管理",
            "desc": null,
            "frontpath": "",
            "condition": "",
            "menu": 1,
            "order": 4,
            "icon": "User",
            "method": "",
            "child": [
                {
                    "id": 575,
                    "rule_id": 574,
                    "status": 1,
                    "create_time": "2024-05-30 14:30:55",
                    "update_time": "2024-05-30 14:30:55",
                    "name": "用户管理",
                    "desc": null,
                    "frontpath": "/user/list",
                    "condition": "",
                    "menu": 1,
                    "order": 50,
                    "icon": "UserFilled",
                    "method": "",
                    "child": []
                },
                {
                    "id": 576,
                    "rule_id": 574,
                    "status": 1,
                    "create_time": "2024-05-30 14:33:11",
                    "update_time": "2024-05-30 14:33:11",
                    "name": "会员等级",
                    "desc": null,
                    "frontpath": "/level/list",
                    "condition": "",
                    "menu": 1,
                    "order": 50,
                    "icon": "DataLine",
                    "method": "",
                    "child": []
                }
            ]
        },
        {
            "id": 6,
            "rule_id": 0,
            "status": 1,
            "create_time": "2019-08-11 13:36:36",
            "update_time": "2024-05-30 16:45:31",
            "name": "商品管理",
            "desc": "shop_goods_list",
            "frontpath": null,
            "condition": null,
            "menu": 1,
            "order": 5,
            "icon": "shopping-bag",
            "method": "GET",
            "child": [
                {
                    "id": 15,
                    "rule_id": 6,
                    "status": 1,
                    "create_time": "2019-12-28 13:44:32",
                    "update_time": "2024-05-30 15:44:44",
                    "name": "规格管理",
                    "desc": "shop_sku_list",
                    "frontpath": "/skus/list",
                    "condition": "",
                    "menu": 1,
                    "order": 19,
                    "icon": "aim",
                    "method": "GET",
                    "child": []
                },
                {
                    "id": 13,
                    "rule_id": 6,
                    "status": 1,
                    "create_time": "2019-12-28 13:42:13",
                    "update_time": "2024-05-30 15:45:04",
                    "name": "商品管理",
                    "desc": "shop_goods_list",
                    "frontpath": "/goods/list",
                    "condition": "",
                    "menu": 1,
                    "order": 20,
                    "icon": "shopping-cart-full",
                    "method": "GET",
                    "child": [
                        {
                            "id": 565,
                            "rule_id": 13,
                            "status": 1,
                            "create_time": "2024-05-30 12:45:24",
                            "update_time": "2024-05-30 12:45:24",
                            "name": "5555",
                            "desc": null,
                            "frontpath": "",
                            "condition": "",
                            "menu": 1,
                            "order": 50,
                            "icon": "AlarmClock",
                            "method": "",
                            "child": []
                        }
                    ]
                },
                {
                    "id": 14,
                    "rule_id": 6,
                    "status": 1,
                    "create_time": "2019-12-28 13:44:00",
                    "update_time": "2024-05-29 18:59:54",
                    "name": "分类管理",
                    "desc": "shop_category_list",
                    "frontpath": "/category/list",
                    "condition": "",
                    "menu": 1,
                    "order": 20,
                    "icon": "menu",
                    "method": "GET",
                    "child": []
                }
            ]
        },
        {
            "id": 511,
            "rule_id": 0,
            "status": 1,
            "create_time": "2024-05-25 13:17:25",
            "update_time": "2024-05-30 16:45:31",
            "name": "订单管理",
            "desc": null,
            "frontpath": "",
            "condition": "",
            "menu": 1,
            "order": 6,
            "icon": "Tickets",
            "method": "",
            "child": [
                {
                    "id": 512,
                    "rule_id": 511,
                    "status": 1,
                    "create_time": "2024-05-25 13:18:03",
                    "update_time": "2024-05-28 14:44:26",
                    "name": "订单管理",
                    "desc": null,
                    "frontpath": "/order/list",
                    "condition": "",
                    "menu": 1,
                    "order": 50,
                    "icon": "Tickets",
                    "method": "",
                    "child": [
                        {
                            "id": 550,
                            "rule_id": 512,
                            "status": 1,
                            "create_time": "2024-05-28 21:15:38",
                            "update_time": "2024-05-28 21:15:38",
                            "name": "sssss",
                            "desc": null,
                            "frontpath": "",
                            "condition": "",
                            "menu": 1,
                            "order": 50,
                            "icon": "",
                            "method": "",
                            "child": []
                        }
                    ]
                }
            ]
        },
        {
            "id": 577,
            "rule_id": 0,
            "status": 1,
            "create_time": "2024-05-30 14:34:37",
            "update_time": "2024-05-30 16:45:31",
            "name": "分销管理",
            "desc": null,
            "frontpath": "",
            "condition": "",
            "menu": 1,
            "order": 7,
            "icon": "Setting",
            "method": "",
            "child": [
                {
                    "id": 579,
                    "rule_id": 577,
                    "status": 1,
                    "create_time": "2024-05-30 14:36:27",
                    "update_time": "2024-05-30 14:36:27",
                    "name": "分销员管理",
                    "desc": null,
                    "frontpath": "/distribution/index",
                    "condition": "",
                    "menu": 1,
                    "order": 50,
                    "icon": "User",
                    "method": "",
                    "child": []
                }
            ]
        },
        {
            "id": 513,
            "rule_id": 0,
            "status": 1,
            "create_time": "2024-05-25 13:45:56",
            "update_time": "2024-05-30 16:45:32",
            "name": "优惠券管理",
            "desc": null,
            "frontpath": "",
            "condition": "",
            "menu": 1,
            "order": 8,
            "icon": "AddLocation",
            "method": "",
            "child": [
                {
                    "id": 545,
                    "rule_id": 513,
                    "status": 1,
                    "create_time": "2024-05-28 14:49:34",
                    "update_time": "2024-05-29 18:59:56",
                    "name": "优惠券管理",
                    "desc": null,
                    "frontpath": "/coupon/list",
                    "condition": "",
                    "menu": 1,
                    "order": 50,
                    "icon": "Coin",
                    "method": "",
                    "child": []
                }
            ]
        },
        {
            "id": 515,
            "rule_id": 0,
            "status": 1,
            "create_time": "2024-05-25 14:14:33",
            "update_time": "2024-05-30 16:45:33",
            "name": "评论管理",
            "desc": null,
            "frontpath": "",
            "condition": "",
            "menu": 1,
            "order": 9,
            "icon": "Aim",
            "method": "",
            "child": [
                {
                    "id": 544,
                    "rule_id": 515,
                    "status": 1,
                    "create_time": "2024-05-28 14:49:02",
                    "update_time": "2024-05-29 18:59:57",
                    "name": "评论管理",
                    "desc": null,
                    "frontpath": "/comment/list",
                    "condition": "",
                    "menu": 1,
                    "order": 50,
                    "icon": "ChatLineSquare",
                    "method": "",
                    "child": []
                }
            ]
        },
        {
            "id": 578,
            "rule_id": 0,
            "status": 1,
            "create_time": "2024-05-30 14:35:29",
            "update_time": "2024-05-30 16:45:33",
            "name": "公告管理",
            "desc": null,
            "frontpath": "",
            "condition": "",
            "menu": 1,
            "order": 10,
            "icon": "ChatLineSquare",
            "method": "",
            "child": [
                {
                    "id": 581,
                    "rule_id": 578,
                    "status": 1,
                    "create_time": "2024-05-30 14:38:53",
                    "update_time": "2024-05-30 14:38:53",
                    "name": "公告管理",
                    "desc": null,
                    "frontpath": "/notice/list",
                    "condition": "",
                    "menu": 1,
                    "order": 50,
                    "icon": "ChatLineRound",
                    "method": "",
                    "child": []
                },
                {
                    "id": 585,
                    "rule_id": 578,
                    "status": 1,
                    "create_time": "2024-05-30 15:05:49",
                    "update_time": "2024-05-30 16:44:52",
                    "name": "测试界面",
                    "desc": null,
                    "frontpath": "",
                    "condition": "",
                    "menu": 1,
                    "order": 50,
                    "icon": "",
                    "method": "",
                    "child": []
                }
            ]
        }
    ],
    "ruleNames": [
        "调度,POST",
        "createRule,POST",
        "updateRule,POST",
        "deleteRule,POST",
        "getRuleList,GET",
        "updateRuleStatus,POST",
        "createRole,POST",
        "updateRole,POST",
        "deleteRole,POST",
        "getRoleList,GET",
        "updateRoleStatus,POST",
        "getGoodsList,GET",
        "getCategoryList,GET",
        "createCategory,POST",
        "sortCategory,POST",
        "updateCategory,POST",
        "updateCategoryStatus,POST",
        "deleteCategory,DELETE",
        "createSkus,POST",
        "deleteSkus,POST",
        "updateSkus,POST",
        "updateSkusStatus,POST",
        "getUserLevelList,GET",
        "createUserLevel,POST",
        "updateUserLevel,POST",
        "updateUserLevelStatus,POST",
        "deleteUserLevel,POST",
        "deleteManager,POST",
        "getManagerList,GET",
        "updateManager,POST",
        "updateManagerStatus,POST",
        "readGoods,GET",
        "updateGoodsSkus,POST",
        "setGoodsBanner,POST",
        "restoreGoods,POST",
        "destroyGoods,POST",
        "deleteGoods,POST",
        "updateGoodsStatus,POST",
        "createGoods,POST",
        "updateGoods,POST",
        "checkGoods,POST",
        "createGoodsSkusCard,POST",
        "sortGoodsSkusCard,POST",
        "updateGoodsSkusCard,POST",
        "deleteGoodsSkusCard,POST",
        "createGoodsSkusCardValue,POST",
        "updateGoodsSkusCardValue,POST",
        "deleteGoodsSkusCardValue,POST",
        "getNoticeList,GET",
        "createNotice,POST",
        "updateNotice,POST",
        "deleteNotice,POST",
        "getCategoryGoods,GET",
        "connectCategoryGoods,POST",
        "deleteCategoryGoods,POST",
        "setRoleRules,POST"
    ]
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/727813.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

密码学及其应用——GMP库在密码学中的应用

GMP&#xff08;GNU Multiple Precision arithmetic library&#xff0c;GNU多精度算术库&#xff09;是一个针对大整数运算的库。这个库提供了许多针对多种多精度类型的计算函数&#xff1a; - 大整数&#xff1a;Z - 大有理数&#xff1a;Q - 大浮点数&#xff1a;R 1. 密码学…

找不到com.fasterxml.jackson.core.exc.StreamWriteException的类文件

1. 前言: 使用springboot搭建的项目, 需要使用 jackson 更改json文件的内容; maven管理jar包, 导入jar包版本信息如下: <!-- 读写json文件所需依赖 --> <dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databin…

陈晓婚前婚后大变样

陈晓婚前婚后大变样&#xff1f;陈妍希揭秘甜蜜与现实的碰撞在娱乐圈的星光璀璨中&#xff0c;有一对夫妻总是津津乐道&#xff0c;那就是陈晓和陈妍希。他们的爱情故事&#xff0c;从荧幕到现实&#xff0c;一直备受关注。然而&#xff0c;近日陈妍希在节目中透露&#xff0c;…

yolov8训练文件夹文件目录介绍及讲解

背景说明 凡是使用过yolov8算法的朋友都知道&#xff0c;在使用yolov8算法训练模型完成后&#xff0c;会在代码目录下默认生成一个runs文件夹&#xff0c;该文件夹通常用来保存模型的训练任务以及相关的模型信息。 如果我们按照任务分类进行点击进入&#xff0c;会发现…

实现一个简易动态线程池

项目完整代码&#xff1a;https://github.com/YYYUUU42/Yu-dynamic-thread-pool 如果该项目对你有帮助&#xff0c;可以在 github 上点个 ⭐ 喔 &#x1f970;&#x1f970; 1. 线程池概念 2. ThreadPoolExecutor 介绍 2.1. ThreadPoolExecutor是如何运行&#xff0c;如何同时…

【第22章】Vue实战篇之文章分类

文章目录 前言一、文章分类列表查询1. 界面2. 脚本3. 展示 二、文章分类添加1. 界面2. 接口脚本3. 点击事件 三、文章分类编辑1. 界面2. 接口脚本3. 点击事件 四、文章分类删除1. 界面2. 接口脚本3. 点击事件 总结 前言 这里来学习文章分类相关界面和接口的调用(增删改查)。 一…

新版二开微信发卡小程序源码卡密系统/支持流量主

新版二开微信发卡小程序源码卡密系统支持流量主。裂变扩展多种领取模式二次开发的发卡小程序源码&#xff0c;其后台采用PHP编写&#xff0c;支持用户通过付费购卡或者观看视频广告领取卡密。 该小程序还支持流量主&#xff0c;因为功能需要&#xff0c;就进行了二开&#xff…

Java基础 - 练习(四)打印九九乘法表

Java基础练习 打印九九乘法表&#xff0c;先上代码&#xff1a; public static void multiplicationTable() {for (int i 1; i < 9; i) {for (int j 1; j < i; j) {// \t 跳到下一个TAB位置System.out.print(j "" i "" i * j "\t"…

C语言的网络编程

目录 引言 一、TCP/IP概述 1. TCP&#xff08;Transmission Control Protocol&#xff09; 2. UDP&#xff08;User Datagram Protocol&#xff09; 二、Socket编程基础 1. 服务器端 2. 客户端 三、URL与HTTP编程 1. 使用libcurl进行HTTP请求 表格总结 TCP/IP与Socke…

【Unity | Editor强化工具】项目备忘录工具

经常会被美术和策划同事反复询问某几个问题&#xff0c;每次都要翻Wiki链接给他们&#xff0c;非常折磨人&#xff0c;所以做了个可以在Unity内部显示备忘录的小工具&#xff0c;能够减少一些查找成本&#xff08;另外我觉得&#xff0c;让他们养成查看Unity内触手可及的信息的…

报错:ZeroDivisionError_ division by zero

问题&#xff1a;除数为0 原代码错误来源 # 归一化 , 保留6位小数 w round(w / img_w, 6) h round(h / img_h, 6) cx round(cx / img_w, 6) cy round(cy / img_h, 6) # print(cls_id, cx, cy, w, h) # 结果保存到数据labels文件夹中的txt文件 out_file.write(str(cls_id) …

Redis 主从复制+哨兵+集群

1、总结写在前面 Redis 集群 数据分片 高可用性 Redis 哨兵 主从复制 故障转移 2、主从复制 2.1、准备配置 查看docker 容器 ip docker inspect 容器id | grep IPAddressdocker inspect -f{{.Name}} {{.NetworkSettings.IPAddress}} $(docker ps -aq)修改配置文件 初始…

从零开始搭建创业公司全新技术栈解决方案

从零开始搭建创业公司全新技术栈解决方案 关于猫头虎 大家好&#xff0c;我是猫头虎&#xff0c;别名猫头虎博主&#xff0c;擅长的技术领域包括云原生、前端、后端、运维和AI。我的博客主要分享技术教程、bug解决思路、开发工具教程、前沿科技资讯、产品评测图文、产品使用体…

Zookeeper 一、Zookeeper简介

1.分布式系统定义及面临的问题 分布式系统是同时跨越多给物理主机&#xff0c;独立运行的多个软件所组成的系统。类比一下&#xff0c;分布式系统就是一群人一起干活。人多力量大&#xff0c;每个服务器的算力是有限的&#xff0c;但是通过分布式系统&#xff0c;由n个服务器组…

Flink 流批一体场景应用及落地情况

摘要&#xff1a;本文由阿里云 Flink 团队苏轩楠老师撰写&#xff0c;旨在介绍 Flink 流批一体在几个常见场景下的应用。内容主要分为以下四个部分&#xff1a; 主要场景 落地情况 未来展望 总结 上篇&#xff1a;流批一体技术简介 在上篇文章中&#xff0c;给大家整体介绍…

有关计算素数的算法

归纳编程学习的感悟, 记录奋斗路上的点滴, 希望能帮到一样刻苦的你! 如有不足欢迎指正! 共同学习交流! 🌎欢迎各位→点赞 👍+ 收藏⭐ + 留言​📝黑暗的笼罩更会凸显光明的可贵! 一、引言 什么是素数 素数,也被称为质数,是指在大于1的自然数中,只能被1和它本身…

【ai】tx2-nx:安装深度学习环境及4.6对应pytorch

参考:https://www.waveshare.net/wiki/Jetson_TX2_NX#AI.E5.85.A5.E9.97.A8 英伟达2021年发布的的tritionserver 2.17 版本中,backend 有tensorflow1 和 onnxruntime ,他们都是做什么用的,作为backend 对于 triton 推理server意义是什么,是否应该有pytorch? Triton Infer…

小程序中用font-spider压缩字体后,字体没效果(解决办法)

因为项目中需要引入外部字体&#xff0c;有两种方案&#xff0c; 第一是把字体下载到本地&#xff0c; 第二种是cdn请求服务器放字体的地址 但是小程序是有大小限制的&#xff0c;所以必须要压缩字体大小&#xff0c;这时候有些人就说了&#xff0c;那把字体放在服务器上&a…

从复用性角度阐述中台建设

目录 复用性中台定义深思中台建设产品线形态何时演变中台能力落地中台 业务中台架构总结 技术学习永不止步&#xff0c;最近也是看了很多关于架构设计相关的专栏&#xff0c;慢慢总结出来一部分知识&#xff0c;代入自己的思考与理解&#xff0c;以及结合并反思自己之前公司的架…

windows和linux下清空Redis

前言 在本文中&#xff0c;我们将详尽阐述在Windows与Linux操作系统中有效清除Redis缓存的实践方法&#xff0c;旨在为您提供清晰、高效的指导流程&#xff0c;确保数据管理的灵活性与效率。 windows下推荐两款可视化工具 Another Redis Desktop Manager 这是我用的最多也是最…