import { createApp } from 'vue'
import App from './App.vue'
// import '@/styles/element/index.scss'
import 'virtual:svg-icons-register'
import globalComponent from './components/index'
import { router } from './router'
import pinia from './store'
import 'default-passive-events'
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'

import 'element-plus/theme-chalk/el-loading.css'
import 'element-plus/theme-chalk/el-message.css'
import 'element-plus/theme-chalk/el-notification.css'
import 'element-plus/theme-chalk/el-message-box.css'
import 'element-plus/theme-chalk/el-drawer.css'

// 暗黑模式
import 'element-plus/theme-chalk/dark/css-vars.css'

// 自定义指令
import { isHasButton }  from '@/directive/has.ts'
// import '@/styles/bosch.scss'

import '@/styles/index.scss'




import MhtMessageBox from '@/components/MhtMessageBox/index.vue'


const app = createApp(App)

// 检测到预加载错误，可能是版本更新

window.addEventListener('vite:preloadError', (event) => {
  console.log('检测到有新版本，即将刷新...');
  window.location.reload() // 例如，刷新页面
  console.log('页面已更新为最新版本...');
})
// isHasButton(app)
app.use(ElementPlus, {
    locale: zhCn,
  })
app.use(isHasButton)
app.use(globalComponent)
app.use('MhtMessageBox', MhtMessageBox)
app.use(pinia)
app.use(router)
app.mount('#app')