zoukankan      html  css  js  c++  java
  • vue项目-更改el-tree根据主题色变化,变更选中节点的颜色和背景色

    效果

     上代码

     1 <style>
     2     .s-bg2{
     3         backgound:#eee;
     4     }
     5     .s-c{
     6         color:bule;
     7     }
     8 </style>
     9 
    10 // 根据主题色变换树的颜色
    11 changeTreeAboutTheme(){
    12   let that = this;
    13   that.$nextTick(function(){
    14       //先获取节点
    15     let array = document.querySelectorAll('.is-current');
    16     if(array && array.length>0){
    17       for (let i = 0; i < array.length; i++) {
    18         const element = array[i];
    19         //将原来的颜色置为无
    20         const content = element.querySelectorAll('.el-tree-node__content');
    21         content[0].style.background  = "none";
    22         // 加类,变更
    23         if(element.className.indexOf('s-bg2') === -1){
    24           element.className += " s-bg2 s-c";
    25         }
    26       }
    27     }
    28   })
    29 },

    不懂私聊。

  • 相关阅读:
    Yum与list结合
    DNS辅助
    DHCP中继
    apache+SSL 搭建https
    vsftpd服务器
    根据Eclipse SVN changelog使用ANT自动打增量包
    SHELL 近期学习
    Tomcat源码学习一
    oracle笔记
    Linux 下安装 SVN服务器
  • 原文地址:https://www.cnblogs.com/ajaxlu/p/12190874.html
Copyright © 2011-2022 走看看