import {createApp} from 'vue'
import App from './App.vue'
//ElementPlus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
// TDesign
import TDesign from 'tdesign-vue-next'

// vant
import Vant from 'vant';

// 引入组件库的少量全局样式变量
import 'tdesign-vue-next/es/style/index.css'
// pinia
import {createPinia} from 'pinia'
//router
import router from './router/index.js'
//crud
import curdVue3 from './utils/curdVue3'
// el-icon
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
// 自定义全局样式
import './assets/styles/global.css' // 引入全局样式文件
import 'vant/lib/index.css'

const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
// 提供全局方法


app.use(ElementPlus, {
    locale: zhCn,
})

app.use(TDesign)
const pinia = createPinia() // 创建 Pinia 实例
app.use(pinia)
app.use(curdVue3)
app.use(router)
app.use(Vant);

app.provide('CreateData', app.config.globalProperties.CreateData)
app.provide('ExecDatabase', app.config.globalProperties.ExecDatabase)
app.provide('ExecDatabaseByParam', app.config.globalProperties.ExecDatabaseByParam)
app.provide('ExecWritePLC', app.config.globalProperties.ExecWritePLC)
app.provide('ExecReadPLC', app.config.globalProperties.ExecReadPLC)
app.provide('ExecIMESAPI', app.config.globalProperties.ExecIMESAPI)
app.provide('ExecAgvApi', app.config.globalProperties.ExecAgvApi)

app.mount('#app')

// useRouteGuard(); // 使用路由守卫

