import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// import ElementPlus from 'element-plus'
// import { ElButton, ElInput } from 'element-plus'

import {
  ElButton,
  ElInput,
  ElSelect,
  ElOption,
  ElLoading,
  ElCheckbox,
  ElCheckboxGroup,
  ElCarousel,
  ElCarouselItem,
  ElBadge,
  ElDropdown,
  ElPopover,
  ElDatePicker,
  ElMessage,
  ElSkeleton,
  ElSkeletonItem,
  ElBreadcrumb,
  ElAffix,
  ElConfigProvider
  // 其他需要的组件
} from 'element-plus'

import 'element-plus/theme-chalk/index.css'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/index.css'
import locale from 'element-plus/lib/locale/lang/zh-cn';

import zhCn from 'element-plus/dist/locale/zh-cn.mjs'

import lazyPlugin from 'vue3-lazyload'


// import zhCn from 'element-plus/lib/locale/lang/zh-cn'
import api from "./utils/api";

//引入封装Axios请求
import Axios from '@/utils/axios';


const app = createApp(App)

app.use(ElButton)
app.use(ElInput)
app.use(ElSelect)
app.use(ElOption)
app.use(ElLoading)
app.use(ElCheckbox)
app.use(ElCheckboxGroup)
app.use(ElCarousel)
app.use(ElCarouselItem)
app.use(ElBadge)
app.use(ElDropdown)
app.use(ElPopover)
app.use(ElDatePicker, {
  locale: zhCn
})
app.use(ElSkeleton)
app.use(ElSkeletonItem)
app.use(ElMessage)
app.use(ElBreadcrumb)
app.use(ElAffix)

app.use(ElConfigProvider)

app.use(lazyPlugin)

app.use(store).use(router).use(Axios)

api.index().then(res => {
  store.state.seachTypeData = res.data.combination
  store.state.indexData = res.data
  store.state.ListSelectBtn = res.data.recommendedTab
  store.state.user = res.data.user
  store.state.nav = res.data.nav
  store.state.wechat = res.data.wechat
  store.state.apartment = res.data.config.apartment
}).finally(() => {
  app.mount('#app')
})