import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import config from '../public/config.js';
import axios from './axios' // 导入配置好的实例
import TDesign from 'tdesign-mobile-vue'
import './assets/main.css'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
// 挂载到全局属性
app.config.globalProperties.$http = axios

// 提供依赖注入
app.provide('config', config)
app.provide('$http', axios)

app.use(router)
app.use(TDesign)
app.use(ElementPlus, { locale: zhCn })
app.use(ElementPlus)
app.mount('#app')
