import { createApp } from 'vue'
import App from './App.vue'
//导入路由配置
import router from './router/'


//导入element-plus
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import 'normalize.css'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css'
import "./assets/css/main.scss"

// import dataV from '@jiaminghi/data-view'

//导入element-plus的图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

//npm uninstall vuex
//npm install pinia
//npm i pinia-plugin-persist 持久化
import { createPinia } from "pinia";
import piniaPluginPersist from 'pinia-plugin-persist'

import 'virtual:svg-icons-register'
//导入自定义
import { permissions } from "./directives";
import { util } from "./util";
import { components } from "./components"



const store = createPinia()
store.use(piniaPluginPersist)



let app = createApp(App)





//全局注册Element图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app
  .use(router)//使用路由
  .use(ElementPlus, {
    locale: zhCn,
  })//使用ElementPlus,并使用中文语言
  // .use(dataV)
  .use(store) //使用pinia数据仓库

  .use(permissions) //使用自定义指令
  .use(util)//使用自定义工具
  .use(components)//自动注册全局组件
  .mount('#app')//挂载到id=app的html元素中



