//JavaScript代码区域
$(function(){
var role_id=1;
$.ajax({
type: "POST",
url: "http://localhost:8004/system/caidan/ztreelist",
data: {"role_id":role_id},
success: function(msg){
$.each(msg.data,function(index,data){
if(data.pid==0){
var lis="
"+data.pname+""$(".layui-layout-left").append(lis)
}
})
$(".clickfunctionleft").on("click",function(){
var id=$(this).data("id")
$(".layui-nav-tree li").empty()
$.each(msg.data,function(index,data){
if(data.pid==id){
var lis=
`
${data.pname}
`$(".layui-nav-tree").append(lis)
// var dd="
列表一儿"// $("dl:[name='dls']").append(dd)
}
})
/*layui.config({
base:'js/'
}).use(['element'],function(){
var element = layui.element()
element.init();//初始化element事件,使菜单展开
});*/
layui.use('element', function(){
var element = layui.element;
element.init();
});
})
}
});
})
一键复制
编辑
Web IDE
原始数据
按行查看
历史