首页 | 5310 | 834 | 2937 | 添加收藏 上一个 下一个
轻量级的原生js权限树插件(原创)

YnTree


YnTree是一款专门用于权限管理的权限树插件,它依靠数据来驱动,不依赖于任何别的插件并且支持ajax。


基本使用


<div id="tree" class=" fl tree"></div>
var options = {
    checkStrictly: true,
    data:[
        {
            name: "系统管理",
            inputName: "system",
            value: "系统管理",
            children: [
                {
                    name: "用户管理",
                    inputName: "user",
                    value: "用户管理",
                    className: "",
                    checked: false,
                    disabled: false,
                    datas: {},
                    children: [
                        {
                            name: "添加用户",
                            inputName: "user",
                            value: "添加用户",
                            checked: false,
                            disabled: true
                        },
                        {
                            name: "查看用户",
                            inputName: "user",
                            value: "查看用户"
                        },
                        {
                            name: "编辑用户",
                            inputName: "user",
                            value: "编辑用户",
                            disabled: true,
                            children: [
                                {
                                    name: "删除用户",
                                    inputName: "user",
                                    value: "删除用户"
                                },
                                {
                                    name: "修改用户",
                                    inputName: "user",
                                    value: "修改用户",
                                    checked: false
                                }
                            ]
                        }
                         
                    ]
                },
                {
                    name: "投诉管理",
                    inputName: "complaint",
                    value: "投诉管理",
                    checked: false,
                    children: [
                        {
                            name: "添加投诉",
                            inputName: "complaint",
                            value: "添加投诉"
                        },
                        {
                            name: "删除投诉",
                            inputName: "complaint",
                            value: "删除投诉"
                        },
                        {
                            name: "编辑投诉",
                            inputName: "complaint",
                            value: "编辑投诉"
                        },
                        {
                            name: "查看投诉",
                            inputName: "complaint",
                            value: "查看投诉"
                        }
                    ]
                }
            ]
        },
        {
            name: "我的公司",
            inputName: "company",
            value: "我的公司",
            children: [
                {
                    name: "公司管理",
                    inputName: "company manage",
                    value: "公司管理"
                },
                {
                    name: "部门管理",
                    inputName: "department manage",
                    value: "部门管理"
                }
            ]
        }
    ]
};
var yntree = new YnTree(document.getElementById("tree"), options);