按钮控制:vue,根据用户权限,控制按钮的显示和隐藏

时间:2024-11-14 07:41:01

{

    "code": 100,

    "msg": "登录成功",

    "role": 1,

    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjoxNjQ2NzI3NDkzLCJlbWFpbCI6IiJ9.9cBPqkkTxXS2aAjwRadcWuQLc5wgHdAG_YeRc82hGz0",

    "data": {

        "username": "admin",

        "icon": "/media/icon//",

        "get_position": "系统管理员",

        "role": 1

    },

    "right": [

        {

            "id": 1,

            "authName": "用户管理",

            "icon": "el-icon-user-solid",

            "children": [

                {

                    "id": 1,

                    "authName": "创建用户",

                    "path": "createuser",

                    "right": "add",

                    "component": "createuser"

                }

            ]

        },

        {

            "id": 2,

            "authName": "部门管理",

            "icon": "el-icon-user-solid",

            "children": [

                {

                    "id": 2,

                    "authName": "创建部门",

                    "path": "createpart",

                    "right": "add", //这里就是控制按钮的功能

                    "component": "createpart"

                }

            ]

        },

    ]

}