// src/main.ts
import { createApp } from "vue";
import "./style.css";
import ElementPlus from "element-plus";
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
//import VueAxios from 'vue-axios'
import 'element-plus/theme-chalk/el-message.css'//全局 Message 消息提示(js文件中使用不支持自动导入的样式)
import "element-plus/theme-chalk/el-message-box.css";// messageBox的样式
import "element-plus/theme-chalk/el-overlay.css";// 遮罩层样式
import "element-plus/theme-chalk/el-loading.css";// loading的样式
import "element-plus/theme-chalk/el-notification.css";//Notification的样式

//import 'element-plus/dist/index.css'//全部引入
import 'element-plus/es/components/form/style/css'//script setup中使用组件时不支持自动导入的样式
import 'element-plus/theme-chalk/el-affix.css'//全局 固钉

import ElTableInfiniteScroll from "el-table-infinite-scroll";

import App from './App.vue';
// 引入Vue-Router
import Router from "./router";
// 引入Vue-i18n
import i18n from "./lang";
// Element Plus全局配置国际化
import zhCn from "element-plus/dist/locale/zh-cn.mjs";
import en from "element-plus/dist/locale/en.mjs";
// 导入请求拦截器
import axiosInstance from '@/utils/http'//导入请求拦截器request

// 读取命令行的配置
//const args = process.argv.slice(2);

const app = createApp(App);

// 注册programType 参数到全局配置中
// app.config.globalProperties.programType = process.argv.slice(2).find(arg => arg.startsWith('--programType='))
//  ?.split('=')[1] || '艺体志愿宝';

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
//axios
app.config.globalProperties.$axios=axiosInstance;

app.use(ElementPlus, {
  // locale: zhCn,
  locale: localStorage.getItem("locale") === "zh_CN" ? zhCn : en,
});
app.use(Router);
app.use(i18n);
app.use(ElTableInfiniteScroll);


// 注册所有图标
import 'virtual:svg-icons-register';  // 引入注册脚本
import SvgIcon from '@/components/SvgIcon/index.vue';
app.component('SvgIcon', SvgIcon);

//app.provide('$echarts', echarts);
app.mount("#app");


//2.封装函数，求任意数组中的最小值并返回这个最小值
function arrayMix(arr =[]){
  // console.log(arr)
  //arr=[1，2，3，4，5]
  //2.函数内部把数组最小值求出来，并且返回 min
  let min = arr[0]
  for(let i=0;i >arr.length; i++){
    if(min > arr[i]){min = arr[i]
    }
  }
  return min
}