自定义主题新增

  • 操作步骤
    • 1.添加自定义模板
    • 2. variables.scss
    • 3.Logo.vue
    • 4.Siderbar目录下的index.vue
  • 主题切换-效果图如下:

操作步骤

1.添加自定义模板

src/layout/components/Settings/index.vue 目录下30行左右新增

         <div class="setting-drawer-block-checbox-item" @click="handleTheme('theme-blue')"><img src="@/assets/images/blue.svg" alt="custom"><div v-if="sideTheme === 'theme-blue'" class="setting-drawer-block-checbox-selectIcon" style="display: block;"><i aria-label="图标: check" class="anticon anticon-check"><svg viewBox="64 64 896 896" data-icon="check" width="1em" height="1em" :fill="theme" aria-hidden="true" focusable="false" class=""><path d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"/></svg></i></div></div>

2. variables.scss

//新增样式名
$base-menu-blue-background:#0043B2;
$blue-sub-menu-background:#003793;
$blue-sub-menu-hover:#023281;//新增导出
:export {
......
menuBlueBackground:$base-menu-blue-background;
}

这里的变量名可以自定义,但还是要注意和后面的一一对应

3.Logo.vue

<template><div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : sideTheme === 'theme-blue' ? variables.menuBlueBackground : variables.menuLightBackground }"><transition name="sidebarLogoFade"><router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/"><img v-if="logo" :src="logo" class="sidebar-logo" /><h1 v-else class="sidebar-title" :style="{color:(sideTheme === 'theme-dark' || sideTheme === 'theme-blue') ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1></router-link><router-link v-else key="expand" class="sidebar-logo-link" to="/"><img v-if="logo" :src="logo" class="sidebar-logo" /><h1 class="sidebar-title" :style="{ color: (sideTheme === 'theme-dark' || sideTheme === 'theme-blue') ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1></router-link></transition></div>
</template>

修改动态的style

4.Siderbar目录下的index.vue

//主要修改el-menu的这两个属性:background-color="settings.sideTheme === 'theme-dark' ? variables.menuBackground : settings.sideTheme === 'theme-blue' ? variables.menuBlueBackground : variables.menuLightBackground":text-color="settings.sideTheme === 'theme-dark' ? variables.menuColor : settings.sideTheme === 'theme-blue' ? variables.menuColor : variables.menuLightColor"第2行修改<div :class="{'has-logo':showLogo}" :style="{ backgroundColor: settings.sideTheme === 'theme-dark' ? variables.menuBackground : settings.sideTheme === 'theme-blue' ? variables.menuBlueBackground : variables.menuLightBackground }">           

主题切换-效果图如下:

若依ruoyi左侧菜单栏增加新的主题色相关推荐

  1. vue-element-admin左侧菜单增加新打开页面功能

    route/index.js layout/components/SidebarItem.vue

  2. 在ECSHOP后台左侧导航中增加新菜单

    在ECSHOP后台左侧导航中增加新菜单 ECSHOP教程 / ecshop 教程网(www.ecshop119.com) 2011-11-08 有个别高级用户(懂PHP的),提到这样的问题: 在后台管 ...

  3. 左侧菜单栏左滑收起展开效果

    上一篇文章 左侧菜单栏折叠展开效果-超级简单介绍了将菜单列表上下展开的效果,这里在上一篇文章的基础上增加了左右折叠展开,有时候左侧菜单可能占了屏幕的一部分宽度,我们想把左侧菜单栏收缩起来以此让右边可视 ...

  4. 超级网管员原有QQ群己满,现增加新群

    <超级网管员>原有QQ群己满,现在增加新群:6971910,请朋友们继续关注.

  5. linux如何右键新建文件夹,在Ubuntu 18.04右键菜单中增加新文档(New Document)及其他类型选项...

    本文教你在Ubuntu 18.04操作系统下使用命令操作在右键菜单中增加"新文档(New Document)"选项,包括为不同文件类型增加右键菜单选项的方法.起因是当我尝试创建一个 ...

  6. python的继承模式_Python之继承--增加新功能,不更改以前的代码

    在实际工作中,设计模式的时候,要增加新功能,不要更改以前的代码,这是封装和继承的高度总结. isinstance('对象',"类") 返回Ture or False issubcl ...

  7. (笔记)Mysql命令grant on:增加新用户并控制其权限

    grant on命令用于增加新用户并控制其权限. grant on命令格式:grant select on 数据库.* to 用户名@登录主机 identified by "密码" ...

  8. 【转】ABAP在表VBAP和VBAK上增加新字段的标准BAPI

    [转载收藏] 在表VBAP和VBAK上增加新字段的标准BAPI 及实现方式: If you have custom ZZ fields on VBAP and VBAK then you can up ...

  9. sap abap在表VBAP和VBAK上增加新字段的标准BAPI

    在表VBAP和VBAK上增加新字段的标准BAPI  If you have custom ZZ fields on VBAP and VBAK then you can update these fi ...

最新文章

  1. 高并发之——创建线程池居然有这么多方式...
  2. RNN以及LSTM的介绍和公式梳理
  3. GDCM:gdcm::DataElement的测试程序
  4. 大姐,你是不是得了尿频?
  5. 算法题+JVM+自定义View,隔壁都馋哭了
  6. 【数据库系统】文件处理系统的弊端
  7. Linux学习总结(33)——Linux Java启动关闭bash脚本
  8. 开源啦:连DeepMind也捉急的游戏,OpenAI给你攻破第一关的高分算法
  9. Illegal characters found in URL
  10. nginx connect() to (13: Permission denied) while connecting
  11. 以下计算机网络新技术是什么,计算机网络新技术概述
  12. 将Ubuntu 用户目录下的中文目录修改为英文
  13. iPhone12、iPhone12 Pro、iPhone12 Max、iPhone12 Pro Max 详细参数配置
  14. Linux下玩转Dota2
  15. DDD领域驱动设计浅谈
  16. 微信早安推送+定时任务配置(精简图文版)
  17. 问题十四:怎么可视化球的法向量
  18. 绝地求生登录计算机需要授权,绝地求生计算机授权收不到怎么办 | 手游网游页游攻略大全...
  19. 自定义菜单的规则和作用?
  20. Android游戏: 连连看

热门文章

  1. 计算机二级几月出成绩,计算机二级考试几月出成绩
  2. 斯坦福开学演讲:不要在不断的优秀里走向平庸!
  3. android多个请求同步,Android的同步和异步理解
  4. 安卓微信自带浏览器无法呼出摄像头问题
  5. android 打印机 api,【报Bug】蓝牙打印API写入中文乱码(包括安卓、IOS)
  6. 华能笔试题计算机考试大纲,华能某电厂值长面试题来了,能通过笔试的来测评一下!...
  7. Mac Docker镜像源修改
  8. 解读YOLO v7的代码(一)模型结构研究
  9. 【数据结构与算法_java】面试题及答案汇总
  10. c语言的按位或,与,非运算符