【Vue3从入门到项目实现】RuoYi-Vue3若依框架前端学习——动态路由与菜单栏

在这里插入图片描述

菜单栏

若依框架的侧边栏组件通常由菜单项和子菜单组成。
登录后,会获取用户拥有的路由菜单
在这里插入图片描述

{"msg": "操作成功","code": 200,"data": [{"name": "System","path": "/system","hidden": false,"redirect": "noRedirect","component": "Layout","alwaysShow": true,"meta": {"title": "系统管理","icon": "system","noCache": false,"link": null},"children": [{"name": "User","path": "user","hidden": false,"component": "system/user/index","meta": {"title": "用户管理","icon": "user","noCache": false,"link": null}},{"name": "Role","path": "role","hidden": false,"component": "system/role/index","meta": {"title": "角色管理","icon": "peoples","noCache": false,"link": null}},{"name": "Menu","path": "menu","hidden": false,"component": "system/menu/index","meta": {"title": "菜单管理","icon": "tree-table","noCache": false,"link": null}},{"name": "Dept","path": "dept","hidden": false,"component": "system/dept/index","meta": {"title": "部门管理","icon": "tree","noCache": false,"link": null}},{"name": "Post","path": "post","hidden": false,"component": "system/post/index","meta": {"title": "岗位管理","icon": "post","noCache": false,"link": null}},{"name": "Dict","path": "dict","hidden": false,"component": "system/dict/index","meta": {"title": "字典管理","icon": "dict","noCache": false,"link": null}},{"name": "Config","path": "config","hidden": false,"component": "system/config/index","meta": {"title": "参数设置","icon": "edit","noCache": false,"link": null}},{"name": "Notice","path": "notice","hidden": false,"component": "system/notice/index","meta": {"title": "通知公告","icon": "message","noCache": false,"link": null}},{"name": "Log","path": "log","hidden": false,"redirect": "noRedirect","component": "ParentView","alwaysShow": true,"meta": {"title": "日志管理","icon": "log","noCache": false,"link": null},"children": [{"name": "Operlog","path": "operlog","hidden": false,"component": "monitor/operlog/index","meta": {"title": "操作日志","icon": "form","noCache": false,"link": null}},{"name": "Logininfor","path": "logininfor","hidden": false,"component": "monitor/logininfor/index","meta": {"title": "登录日志","icon": "logininfor","noCache": false,"link": null}}]}]},{"name": "Monitor","path": "/monitor","hidden": false,"redirect": "noRedirect","component": "Layout","alwaysShow": true,"meta": {"title": "系统监控","icon": "monitor","noCache": false,"link": null},"children": [{"name": "Online","path": "online","hidden": false,"component": "monitor/online/index","meta": {"title": "在线用户","icon": "online","noCache": false,"link": null}},{"name": "Job","path": "job","hidden": false,"component": "monitor/job/index","meta": {"title": "定时任务","icon": "job","noCache": false,"link": null}},{"name": "Druid","path": "druid","hidden": false,"component": "monitor/druid/index","meta": {"title": "数据监控","icon": "druid","noCache": false,"link": null}},{"name": "Server","path": "server","hidden": false,"component": "monitor/server/index","meta": {"title": "服务监控","icon": "server","noCache": false,"link": null}},{"name": "Cache","path": "cache","hidden": false,"component": "monitor/cache/index","meta": {"title": "缓存监控","icon": "redis","noCache": false,"link": null}},{"name": "CacheList","path": "cacheList","hidden": false,"component": "monitor/cache/list","meta": {"title": "缓存列表","icon": "redis-list","noCache": false,"link": null}}]},{"name": "Tool","path": "/tool","hidden": false,"redirect": "noRedirect","component": "Layout","alwaysShow": true,"meta": {"title": "系统工具","icon": "tool","noCache": false,"link": null},"children": [{"name": "Build","path": "build","hidden": false,"component": "tool/build/index","meta": {"title": "表单构建","icon": "build","noCache": false,"link": null}},{"name": "Gen","path": "gen","hidden": false,"component": "tool/gen/index","meta": {"title": "代码生成","icon": "code","noCache": false,"link": null}},{"name": "Swagger","path": "swagger","hidden": false,"component": "tool/swagger/index","meta": {"title": "系统接口","icon": "swagger","noCache": false,"link": null}}]},{"name": "Http://ruoyi.vip","path": "http://ruoyi.vip","hidden": true,"component": "Layout","meta": {"title": "若依官网","icon": "guide","noCache": false,"link": "http://ruoyi.vip"}}]
}

动态路由

打开src\router\index.js
在这里插入图片描述
公共路由主要包括登录、注册、首页、401、404等页面路由

既然是动态路由,并且后端接口会传过来用户拥有的路由信息。
找一找哪里实现了动态路由的构造。
src/permission.js
在这里插入图片描述
找到中src\store\modules\permission.js中的generateRoutes(roles)方法:
在这里插入图片描述
从后端获取到路由之后,遍历后台传来的路由字符串,转换为组件对象。遍历上面提到的dynamicRoutes,把有权限的加入菜单。

创建菜单

既然菜单与路由是由后端传过来的。那么就可以进行增删改查,自定义侧边栏的菜单显示了。
创建一个新的功能页面:
在这里插入图片描述
··················································································································································································

在这里插入图片描述
··················································································································································································
在这里插入图片描述
·························································································
创建好以后:
在这里插入图片描述
就可以看的菜单栏有我们新的菜单。(超级管理员角色登录)
我们在@/views 文件下创建对应的文件src\views\ai\chat\index.vue
随便加点内容。

<template>讯飞星火
</template><script></script>

点击我们新添加的菜单,发现可以访问。

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

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

相关文章

git操作:使用vscode集成

git操作方式 其实git操作一般有三种方式 分别是终端命令行,开发工具集成,专业的git可视化工具 我前面几章说的都是git的命令行操作,今天这篇文章主要是针对开发工具vscode集成git操作进行演示 说明一下,这里之所以选择vscode,是因为本人用的就是vscode,每个开发工具基本都有…

spark链接hive时踩的坑

使用spark操作hive&#xff0c;使用metastore连接hive&#xff0c;获取hive的数据库时&#xff0c;当我们在spark中创建数据库的时候&#xff0c;创建成功。 同时hive中也可以看到这个数据库&#xff0c;建表插入数据也没有问题&#xff0c;但是当我们去查询数据库中的数据时&a…

IDEA 出现问题:Idea-操作多次commit,如何合并为一个并push解决方案

❤️作者主页&#xff1a;小虚竹 ❤️作者简介&#xff1a;大家好,我是小虚竹。2022年度博客之星评选TOP 10&#x1f3c6;&#xff0c;Java领域优质创作者&#x1f3c6;&#xff0c;CSDN博客专家&#x1f3c6;&#xff0c;华为云享专家&#x1f3c6;&#xff0c;掘金年度人气作…

Python---继承

1、什么是继承 我们接下来来聊聊Python代码中的“继承”&#xff1a;类是用来描述现实世界中同一组事务的共有特性的抽象模型&#xff0c;但是类也有上下级和范围之分&#xff0c;比如&#xff1a;生物 > 动物 > 哺乳动物 > 灵长型动物 > 人类 > 黄种人 从哲学…

通过rc.local开机自启执行nohup命令运行Flask,nohup.out中没有Flask请求响应日志

需求 通过修改/etc/rc.d/rc.local&#xff0c;实现开机自启Flask服务&#xff0c;CentOS 7.9。rc.local参考链接1&#xff0c;参考链接2。 问题 在/etc/rc.d/rc.local中添加 /home/python/face_jiance/kaijiziqi.sh 在/home/python/face_jiance/kaijiziqi.sh中写 nohup /…

数据可视化软件的兴起:背后的驱动力

在当今信息时代&#xff0c;数据变得比以往任何时候都更为重要。数据可视化软件的广泛应用成为了一种趋势。那么&#xff0c;为什么越来越多的人选择使用数据可视化软件呢&#xff1f;今天我就以自己的工作经验为基础&#xff0c;进行简单的分析。 数据可视化软件能将枯燥的数…

react-lazyload 的介绍、安装、使用。

目录 基本介绍 安装 使用 基本使用 详细属性 基本介绍 react-lazyload 是一个 React 组件&#xff0c;用于延迟加载&#xff08;懒加载&#xff09;页面上的图片或其他资源。懒加载是一种优化手段&#xff0c;它允许页面在初次加载时只加载可视区域内的内容&#xff0c;…

vue3移动端脚手架(纯净,集成丰富)

概述 一个纯净的移动端框架 &#xff0c;用到了 Vue3 vuex Vite3 Vant3 sass eslint stylelint htmlhint husky commitlint axios axios-adapter VConsole 自定义全局 loading &#xff0c;自定义函数式 dialog &#xff08;api模仿微信小程序&#xff09;&#x…

增强现实中的真实人/机/环与虚拟人/机/环

在增强现实中&#xff0c;真实人与虚拟人、真实机器与虚拟机器、真实环境与虚拟环境之间有着密切的关系。增强现实技术通过将真实与虚拟相结合&#xff0c;打破了传统的现实世界与虚拟世界的界限&#xff0c;创造出了一种新的体验方式。真实人、真实机器和真实环境与其对应的虚…

linux进入emergency mode

问题描述 linux系统进入emergency mode模式 解决方法 查看问题原因 journalctl -xb -p3 使用fsck 不一定是sda2&#xff0c;也可能是其他&#xff0c;我的是/dev/sda6&#xff0c;然后接受所有的option&#xff0c;完毕后重启电脑 fsck /dev/sda2接受所有的选项&#xff…

Python与ArcGIS系列(十六)重复节点检测

目录 0 简述1 实例需求2 arcpy开发脚本0 简述 在处理gis线图层和面图层数据时,有时候会遇到这种情况:数据存在重复节点或伪重复节点(两个节点距离极小),往往我们需要对这种数据进行检测标注或进行修改。本篇将介绍如何利用arcpy及arcgis的工具箱实现这个功能。 1 实例需求…

【UE 材质】任务目标点效果

效果 步骤 1. 新建一个工程&#xff0c;创建一个Basic关卡 2. 新建一个材质&#xff0c;这里命名为“M_GoalPoint” 打开“M_GoalPoint”&#xff0c;设置混合模式为“半透明”&#xff0c;勾选“双面” 在材质图表中添加如下节点 此时预览效果如下 继续添加如下节点 此时效果…

无人机巡检中台揭秘,无人机管控平台助力巡查无人机巡检方案落地

随着无人机智能巡检的飞速发展&#xff0c;巡查无人机应用场景也日益多元&#xff0c;无人机巡检方案被频繁落地到工业生产及巡检巡逻业务中。而无人机管控平台应运而生&#xff0c;成为推动无人机智能巡检的关键工具。那我们一起来看一下无人机管控平台的作用&#xff1a; 一、…

微信小程序引入Vant Weapp修改样式不起作用,使用外部样式类进行覆盖

一、引入Vant Weapp后样式问题 在项目中使用第三方组件修改css样式时,总是出现各种各样问题,修改的css样式不起作用,没有效果,效果不符合预期等。 栗子(引入一个搜索框组件)实现效果: 左侧有一个搜索文字背景为蓝色,接着跟一个搜索框 wxml <view class"container&q…

【Python】 Python web开发库大全

库排序是按照使用人数和文档的活跃度为参考进行的&#xff0c;建议大家使用排名靠前的框架&#xff0c;因为它们的文档更齐全&#xff0c;技术积累要更多&#xff0c;社区更繁盛&#xff0c;能得到更好的支持&#xff0c;这样在遇到自己无法解决的问题&#xff0c;可以更快更高…

Mint Blockchain,一个聚焦在 NFT 领域的 L2 网络

Mint 是什么&#xff1f; Mint 是一个聚焦在 NFT 领域的创新型 L2 网络。Mint Blockchain 致力于促进 NFT 资产协议标准的创新和现实商业场景中 NFT 资产的大规模采用。 不管是过去 3 年在以太坊网络涌现的 NFT&#xff0c;还是当下在比特币网络活跃的“铭文” NFT&#xff0c…

微信小程序引入vant-weapp爬出坑

最新的微信小程序的项目结构跟之前的不一样&#xff0c;然后&#xff0c;按照vant-weapp上的官方文档&#xff0c;安装步骤失败&#xff0c;提示了各种错误。如果你的微信小程序结构跟我的一致&#xff0c;可以采用和我一样的方案。 微信小程序引入vant-weapp爬出坑 移动pack…

深入浅出:HTTPS单向与双向认证及证书解析20231208

介绍: 网络安全的核心之一是了解和实施HTTPS认证。本文将探讨HTTPS单向认证和双向认证的区别&#xff0c;以及SSL证书和CA证书在这些过程中的作用&#xff0c;并通过Nginx配置实例具体说明。 第一部分&#xff1a;HTTPS单向认证 定义及工作原理&#xff1a;HTTPS单向认证是一…

做数据分析为何要学统计学(5)——什么问题适合使用t检验?

t检验&#xff08;Students t test&#xff09;&#xff0c;主要依靠总体正态分布的小样本&#xff08;例如n < 30&#xff09;对总体均值水平进行差异性判断。 t检验要求样本不能超过两组&#xff0c;且每组样本总体服从正态分布&#xff08;对于三组以上样本的&#xff0…

同一个kmz数据同样的底图在QGIS上显示位置正常, 在Mars3d中显示就偏移了一些

问题&#xff1a; 1.同一个kmz数据同样的底图在QGIS上显示位置正常, 在网页中显示就偏移了一些 在qgis上的显示效果&#xff0c;和在mars3d的显示效果&#xff1a;数据明显存在偏移。 解决步骤&#xff1a; 1.查看了kmz数据&#xff0c;里面实际是tif图片数据&#xff0c;估…