/*
 * @Author: your name
 * @Date: 2021-03-12 14:10:03
 * @LastEditTime: 2021-03-26 09:04:37
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue3-element-admin\src\directives\modules\permission.js
 */

const role = (el, binding, app, router, store) => {
    const { value } = binding;
    function check(roleId) {
        if(roleId == store.getters.userinfo.roleId){
            return true;
        }
        return false;
    }

    if (value) {
        let hasRole = check(value);
        if (!hasRole) {
            // 没有权限 移除Dom元素
            el.parentNode && el.parentNode.removeChild(el);
        }
    }
};

export default role;
