import { createApp } from 'vue';
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import locale from 'element-ui/lib/locale/lang/zh-CN'
import '@/request/setupAxios'
import '@/assets/style/public.scss'
import user from '@/state/user'
const app = createApp(App);
app.use(router)
app.use(ElementPlus, { locale })
app.mount('#app')
app.directive('power',{
    mounted(el,binding) {
        let replacelist = {
            'organizationlist':'organization',
        }
        let routeName = router.currentRoute._value.name
        let roleKeyList = user._value.roleKeyList
        let rokeName =  `${replacelist[routeName] || routeName}:${binding.value}`
        if(!roleKeyList.includes(rokeName)){
            el.parentNode&&el.parentNode.removeChild(el);
        }
    }
})