/*
 * @Author: wangming
 * @Date: 2020-06-10 10:53:49
 * @LastEditors: wangming
 * @LastEditTime: 2020-06-29 10:39:12
 * @Description: file content
 */

import Vue from 'vue';

const action = Vue.directive('srcAuth', {
    inserted: function(el, binding, vnode) {
        let u = localStorage.getItem('userInfo') || '{}';
        let userInfo = JSON.parse(u);
        let m = localStorage.getItem('buttonList') || '[]';
        let buttonList = JSON.parse(m);
        if (buttonList.indexOf(binding.value.code) > -1 ) { //|| userInfo.userId == '1'
            el.onclick = binding.value.click;
        }
    }
});

export default action;