easyui(Tree前端工作)

1.全局path定义
    base标签:base的标签的href属性里面的内容会自动添加到在hread标签里面的引入的路径前面

<base href = "${pageContext.request.servletContext.contextPath}/static/">    

    var globalPath = "${pageContext.request.servletContext.contextPath}";
 

 2.页面缓存
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">  
 

3.postman使用
    接口测试工具;postman发送请求给服务器,然后从服务器接受响应,最后在postman中展示出来。 

4.tree组件实现JSON数据绑定
    标签实现——不推荐
    JSON实现
    $('#tt').tree({    
            url:'tree_data.json'   
    });  

5.动态添加选项卡 

 $(function(){
            //绑定属性菜单绑定数据
            $("#menuTree").tree({    
                //实际开发中这里应该获取的是后台的数据(从servlet中获取)
                url:'tree_data.json',
                //在用户点击一个节点的时候触发。
                onClick: function(node){
                    //alert(node.text);  // 在用户点击的时候提示
                    console.log(node.id,node.text,node.children);
                    if(node.id === "-1"){
                        return;
                    }
                    //判断选项卡是否存在选中
                    var flag = $("#tabs_index").tabs('exists',node.text);
                    //alert(flag);
                    if(flag){
                        $("#tabs_index").tabs('select',node.text);
                        return;
                    }
                    
                    // 添加一个未选中状态的选项卡面板
                    $('#tabs_index').tabs('add',{
                        title: node.text,
                        content:node.text,
                        closable:true,  
                    });
                }
            });  
        });


版权声明:本文为x3547749154原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。