import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
import './utils/rem'
import './assets/scss/main.scss';
import ElementPlus from 'element-plus'//引入elmentplus的组件
import zhCn from 'element-plus/es/locale/lang/zh-cn';
import 'element-plus/dist/index.css'//引入elmentplus的组件的样式
import * as ElementPlusIconsVue from '@element-plus/icons-vue' //图标
import 'virtual:svg-icons-register'
import SvgIcon from '@/components/SvgIcon/index.vue' // 导入 SVG 组件

//需要npm install pinia-plugin-persist npm install pinia-plugin-persist@1.0.0    -- 支持本地数据持久化保存
import piniaPluginPersist from 'pinia-plugin-persist'

import NotificationService from './common/notification.js';

import '@/stores/login'
const app = createApp(App)

//让ElementPlus 图标文件生效
for (const[key,component] of Object.entries(ElementPlusIconsVue)){
   app.component(key,component)
}

app.component('svg-icon', SvgIcon)
app.use(createPinia().use(piniaPluginPersist));

app.provide('notification', NotificationService);
app.use(router)
app.use(ElementPlus,{locale: zhCn});//全局引入ElementPlus

app.mount('#app')
