import { createApp } from 'vue'
import App from './App.vue'
import router from "./router";
import 'normalize.css'
import 'element-plus/dist/index.css'
import '@/styles/var.scss'
import '@/styles/common.scss'
import '@/styles/element.scss'
//引入注册脚本
import 'virtual:svg-icons-register'
import registerGlobalComponents from '@/components/globalComponents';
import {formatTime} from '@/utils/common'
import {usePermission} from '@/hooks/permission'

const {hasPermission}=usePermission()

const app= createApp(App)

// 挂载一个全局格式化时间方法
app.config.globalProperties.formatTime=formatTime

// 挂载一个全局的判断权限的方法
app.config.globalProperties.hasPermission=hasPermission

// 注册全局指令
import * as directives from '@/directives'
Object.keys(directives).forEach(key =>{
  app.directive(key,directives[key])
})

// 注册全局组件
registerGlobalComponents(app);

app.use(router)
app.mount('#app')
