<small id='0Gwa0'></small><noframes id='0Gwa0'>

    <legend id='0Gwa0'><style id='0Gwa0'><dir id='0Gwa0'><q id='0Gwa0'></q></dir></style></legend>
  • <i id='0Gwa0'><tr id='0Gwa0'><dt id='0Gwa0'><q id='0Gwa0'><span id='0Gwa0'><b id='0Gwa0'><form id='0Gwa0'><ins id='0Gwa0'></ins><ul id='0Gwa0'></ul><sub id='0Gwa0'></sub></form><legend id='0Gwa0'></legend><bdo id='0Gwa0'><pre id='0Gwa0'><center id='0Gwa0'></center></pre></bdo></b><th id='0Gwa0'></th></span></q></dt></tr></i><div id='0Gwa0'><tfoot id='0Gwa0'></tfoot><dl id='0Gwa0'><fieldset id='0Gwa0'></fieldset></dl></div>

    1. <tfoot id='0Gwa0'></tfoot>
          <bdo id='0Gwa0'></bdo><ul id='0Gwa0'></ul>

        layui tree点击标题选中加色实例代码

        时间:2024-11-11

          • <i id='8qO9N'><tr id='8qO9N'><dt id='8qO9N'><q id='8qO9N'><span id='8qO9N'><b id='8qO9N'><form id='8qO9N'><ins id='8qO9N'></ins><ul id='8qO9N'></ul><sub id='8qO9N'></sub></form><legend id='8qO9N'></legend><bdo id='8qO9N'><pre id='8qO9N'><center id='8qO9N'></center></pre></bdo></b><th id='8qO9N'></th></span></q></dt></tr></i><div id='8qO9N'><tfoot id='8qO9N'></tfoot><dl id='8qO9N'><fieldset id='8qO9N'></fieldset></dl></div>
              <legend id='8qO9N'><style id='8qO9N'><dir id='8qO9N'><q id='8qO9N'></q></dir></style></legend>
                <bdo id='8qO9N'></bdo><ul id='8qO9N'></ul>

                <tfoot id='8qO9N'></tfoot>

                <small id='8qO9N'></small><noframes id='8qO9N'>

                  <tbody id='8qO9N'></tbody>

                  layui tree 点击标题选中加色,具体实例代码如下:
                  layui.use('tree', function () {
                                      var tree = layui.tree;
                                      //渲染
                                      stree = tree.render({
                                          elem: '#demo2'  //绑定元素
                                          , data: treeService
                                          , showCheckbox: true
                                          , click: function (obj) { //节点选中状态改变事件监听,全选框有自己的监听事件
                                              console.log(obj);
                                              var nodes = document.getElementsByClassName("layui-tree-txt");
                                              for (var i = 0; i < nodes.length; i++) {
                                                  if (nodes[i].innerHTML === obj.data.title) {                       // if(obj.data.children){} //判断当前节点是否有子节点
                                                      if (obj.data.children == null || obj.data.children.length == 0) {//判断是不是子节点(父节点对应的children不为空,且有的父节点长度为0也可代表子节点)
                                                          nodes[i].style.color = "#555";//灰色
                                                          nodes[i].checked = true;
                                                          //将选中的值存储在Session
                                                      } else {
                                                          nodes[i].style.color = "#555";//灰色
                                                      }
                                                  } else {
                                                      nodes[i].style.color = "#555";//灰色
                                                  }
                                              }
                                          }
                                      });
                                  });
                  上一篇:LayUI tree组件实现展开全部和折叠全部的功能 下一篇:没有了

                  相关文章

                1. <tfoot id='6ZtyB'></tfoot>
                    <bdo id='6ZtyB'></bdo><ul id='6ZtyB'></ul>
                  <legend id='6ZtyB'><style id='6ZtyB'><dir id='6ZtyB'><q id='6ZtyB'></q></dir></style></legend>

                    1. <small id='6ZtyB'></small><noframes id='6ZtyB'>

                      <i id='6ZtyB'><tr id='6ZtyB'><dt id='6ZtyB'><q id='6ZtyB'><span id='6ZtyB'><b id='6ZtyB'><form id='6ZtyB'><ins id='6ZtyB'></ins><ul id='6ZtyB'></ul><sub id='6ZtyB'></sub></form><legend id='6ZtyB'></legend><bdo id='6ZtyB'><pre id='6ZtyB'><center id='6ZtyB'></center></pre></bdo></b><th id='6ZtyB'></th></span></q></dt></tr></i><div id='6ZtyB'><tfoot id='6ZtyB'></tfoot><dl id='6ZtyB'><fieldset id='6ZtyB'></fieldset></dl></div>