layui tree点击tittle更改颜色

找到layui下tree.jss(可以搜索  通过搜索b.prototype)

			 $(".layui-tree-txt").css("color","#555"); 
			 $(this).css("color","red");
b.prototype.spread = function(e, a) {
		var n = this,
			t = n.config,
			r = e.children("." + p),
			l = r.children("." + f),
			c = r.find("." + o),
			k = r.find("." + y),
			m = t.onlyIconControl ? c : l,
			x = "";
		m.on("click", function(i) {
			var a = e.children("." + v),
				n = m.children(".layui-icon")[0] ? m.children(".layui-icon") : m.find(".layui-tree-icon").children(".layui-icon");
			if(a[0]) {
				if(e.hasClass(C)) e.removeClass(C), a.slideUp(200), n.removeClass(u).addClass(h);
				else if(e.addClass(C), a.slideDown(200), n.addClass(u).removeClass(h), t.accordion) {
					var r = e.siblings("." + s);
					r.removeClass(C), r.children("." + v).slideUp(200), r.find(".layui-tree-icon").children(".layui-icon").removeClass(u).addClass(h)
				}
			} else x = "normal"
		}), k.on("click", function() {
			var n = i(this);
			layui.$("." + p).removeClass("custom-tree-item-clicked");
			//注意这里的k 对应着上面的k.on("click",的变量 有可能你的不叫k,修改成自己的变量名称
//          k.addClass("custom-tree-item-clicked");
			 $(".layui-tree-txt").css("color","#555"); 
			 $(this).css("color","red");
             var n = i(this);
			n.hasClass(d) || (x = e.hasClass(C) ? t.onlyIconControl ? "open" : "close" : t.onlyIconControl ? "close" : "open", t.click && t.click({
				elem: e,
				state: x,
				data: a
			}))
		})
	}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值