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

news2024/12/22 0:01:36

默认激活菜单,效果: 

默认激活菜单,效果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"
    ]
}

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

FKA总结

问题点&#xff1a; 原因分析: 工作状态下进入充电模式&#xff0c;程序检测到的电压会降低&#xff0c;比如8.07V的电池电压&#xff0c;它处于充满的临界状态&#xff0c;开机情况下程序检测的电压会降到7.98V&#xff0c;然后进入充电模式显示红灯 关机状态下进入充电模式…

volatile关键字(juc编程)

volatile关键字 3.1 看程序说结果 分析如下程序&#xff0c;说出在控制台的输出结果。 Thread的子类 public class VolatileThread extends Thread {// 定义成员变量private boolean flag false ;public boolean isFlag() { return flag;}Overridepublic void run() {// 线…

数据结构与算法3---栈与队

一、栈 1、顺序栈 #define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <stdlib.h> //开辟空间#define MAXSIZE 50//顺序栈的基本算法 typedef struct {int stack[MAXSIZE];int top; }SqStack;//初始化 void InitStack(SqStack* S) {S->top …

[BUUCTF从零单排] Web方向 01.Web入门篇之粗心的小李解题思路

这是作者新开的一个专栏《BUUCTF从零单排》&#xff0c;旨在从零学习CTF知识&#xff0c;方便更多初学者了解各种类型的安全题目&#xff0c;后续分享一定程度会对不同类型的题目进行总结&#xff0c;并结合CTF书籍和真实案例实践&#xff0c;希望对您有所帮助。当然&#xff0…

JEnv-for-Windows 详细使用

管理员执行jenv.bat文件 执行正常, 接下来就是按照官网的命令就行了 文件下载地址 https://download.csdn.net/download/qq_43071699/89462664 JEnv 是一个强大的Java版本管理工具&#xff0c;允许开发者在多个Java版本之间轻松切换。以下是一些常用的JEnv命令&#xff0c;这…

【网络安全产品】---网闸

了解了不少安全产品&#xff0c;但是对网闸的理解一直比较模糊&#xff0c;今天 what 网闸是安全隔离与信息交换系统的简称&#xff0c;使得在不影响数据正常通信的前提下&#xff0c;让络在不连通的情况下数据的安全交换和资源共享&#xff0c;对不同安全域/网络之间实现真正…

vue项目——前端CryptoJS加密、解密

1、vue项目需要安装CryptoJS安装包 npm install crypto-js 2、在项目中引入CryptoJS import CryptoJS from crypto-js 3、使用&#xff0c;代码如下 // 此处key为16进制let key jiajiajiajiajiajiajiajia;console.log(密钥&#xff1a;, key);// key格式化处理key Crypt…

web中间件漏洞-weblogic漏洞-弱口令war包上传

web中间件漏洞-weblogic漏洞-弱口令war包上传 弱口令war包上传 制作war包 jar cvf ma.war.(最后的.代表打包当前目录) 弱口令weblogic/weblogic123 点击部署后、一直点击下一步 访问webshell

网络基础篇:网络模型

目录 一、初识网络 二、网络的分层 OSI七层模型 TCP/IP四层模型 网络与系统的关系 网络传输基本流程 数据包封装和分用 三、IP地址与MAC地址 认识IP地址 认识MAC地址 IP与MAC的关系 一、初识网络 同一台设备上的进程间通信有很多种方式 &#xff1a; 管道&#xff08…

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"…

【CPP】选择排序:冒泡排序、快速排序

目录 1.冒泡排序简介代码分析 2.快速排序2.1霍尔版本简介代码分析 2.2挖坑版本2.3前后指针版本2.4非递归的快排思路代码 什么是交换排序&#xff1f; 基本思想&#xff1a;所谓 交换&#xff0c;就是根据序列中两个记录键值的比较结果来对换这两个记录在序列中的位置&#xff0…

Python基础教程(二十六):对接MongoDB

&#x1f49d;&#x1f49d;&#x1f49d;首先&#xff0c;欢迎各位来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里不仅可以有所收获&#xff0c;同时也能感受到一份轻松欢乐的氛围&#xff0c;祝你生活愉快&#xff01; &#x1f49d;&#x1f49…

maxKb+ollama+lama2-chinese 基于知识库+本地模型的知识问答系统

maxKbollamalama2-chinese 基于知识库本地模型的知识问答系统 搭建步骤 搭建maxKb docker run -d --namemaxkb -p 8080:8080 -v ~/.maxkb:/var/lib/postgresql/data cr2.fit2cloud.com/1panel/maxkb# 用户名: admin # 密码: MaxKB123..github的访问地址&#xff1a;https://…

压缩字体文件包大小pingfang等通用方法

压缩字体包大小 1、确保已经安装python 借助python环境&#xff0c;安装fonttools插件&#xff1a; 如果运行pip失败&#xff0c;注意看一下自己的环境变量是否错误&#xff1a; 在用户环境变量中与python安装目录下scripts相对应 pip install fonttools2、如果显示下载超…

家用电器信息管理系统

摘 要 随着互联网的快速发展&#xff0c;传统家电行业受到冲击&#xff0c;逐渐向智能家居市场转型。因此&#xff0c;智能家居无疑是一个有着巨大市场需求和新兴发展空间的新兴产业&#xff0c;也是人们追求安全、便捷、舒适的生活方式的必然趋势。互联网推动了我国传统家居产…

TCP编程

自学python如何成为大佬(目录):https://blog.csdn.net/weixin_67859959/article/details/139049996?spm1001.2014.3001.5501 由于TCP连接具有安全可靠的特性&#xff0c;所以TCP应用更为广泛。创建TCP连接时&#xff0c;主动发起连接的叫客户端&#xff0c;被动响应连接的叫服…

华为设备SSH远程访问配置实验简述

一、实验需求: 1、AR1模拟电脑SSH 访问AR2路由器。 二、实验步骤&#xff1a; 1、AR1和AR2接口配置IP&#xff0c;实现链路通信。 2、AR2配置AAA模式 配置用户及密码 配置用户访问级别 配置用户SSH 访问服务 AR2配置远程服务数量 配置用户远程访问模式为AAA 配置允许登录接入用…

东芝-Soft Limit 报警及其解决办法

灵感来源与生活,在生活中总能有意想不到的惊喜,下面来看看小编今天的惊喜!!! 今天不知道怎么了,有人来找就说是机器人坏了,一直报警,重启关机回原点也没有用。 意外到来,只能使用手柄将控制器打手动,来看看报警显示什么。 下面就看到了这,我靠第一次看见,只能看看手…

【决战欧洲之巅】苏格兰VS瑞士-AI预测走地数据

初步分析 苏格兰队是欧洲杯的老牌球队&#xff0c;虽然首场比赛表现不佳&#xff0c;但他们的实力不容小觑。苏格兰在预选赛中表现出色&#xff0c;以小组第二的身份晋级&#xff0c;并拥有包括多名英超球员在内的强大阵容&#xff0c;如曼联中场麦克托米奈和利物浦右后卫罗伯…

【Android面试八股文】你刚刚提到了V2签名使用美团的Walle实现多渠道打包,那么你能讲一讲Android 签名的 v1、v2、v3、v4版本的区别吗?

文章目录 前言一、简介二、APK 签名方案 v1 (JAR签名)2.1. 签名过程2.2 验证过程2.3 详细例子2.4 优缺点2.5 美团基于V1版本的多渠道打包方案三、APK 签名方案 v23.1 为什么要设计APK 签名方案 v2 ?3.2 APK 签名方案 v2 : 签名前和签名后的 APK3.2.1 签名前和签名后的 APK3.2…