import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import {
  ActionBar,
  ActionBarIcon,
  ActionBarButton,
  Divider,
  Popup,
  Overlay,
  Loading,
  Dialog,
  ContactCard,
  Form,
  AddressEdit,
  AddressList,
  Field,
  CellGroup,
  Cell,
  SwipeCell,
  Icon,
  Stepper,
  Card,
  Checkbox,
  CheckboxGroup,
  Button,
  Swipe,
  SwipeItem,
  PullRefresh,
  List,
  Tab,
  Tabs,
  SubmitBar,
  Toast,
  Skeleton,
  RadioGroup,
  Radio,
  NoticeBar,
  ActionSheet,
  Cascader,
  Col,
  Row,
  Slider,
  DatePicker,
  Switch,
  Calendar,
  Picker,
  Uploader,
  Tag,
  DropdownMenu,
  DropdownItem,
  Notify,
  ConfigProvider,
  NavBar,
  Area,
  Popover,
  Collapse,
  CollapseItem,
  PickerGroup,
  TimePicker,
  BackTop,
  Progress,
  Tabbar,
  TabbarItem,
  Search,
  FloatingBubble,
  Grid,
  GridItem,
  CountDown,
  Space,
  Rate,
  NumberKeyboard,
  Empty,
} from "vant";
import { Image as VanImage } from "vant";
import store from "./store";
import router from "./router";
import "lib-flexible/flexible";
import "vant/lib/index.css"; // 全局引入样式
import "@vant/touch-emulator";
// 导入语言
import i18n from "./utils/i18n";

const app = createApp(App); // 创建实例
const pinia = createPinia()
// 全局过滤器
app.config.globalProperties.$filters = {
  prefix(url) {
    if (url && url.startsWith("http")) {
      return url;
    } else {
      url = `http://backend-api-01.newbee.ltd${url}`;
      return url;
    }
  },
};
// Vant组件注册
app
  .use(ActionBarButton)
  .use(ActionBarIcon)
  .use(ActionBar)
  .use(Divider)
  .use(Popup)
  .use(Overlay)
  .use(Loading)
  .use(Dialog)
  .use(Toast)
  .use(ContactCard)
  .use(Form)
  .use(AddressEdit)
  .use(AddressList)
  .use(Field)
  .use(CellGroup)
  .use(Cell)
  .use(SwipeCell)
  .use(Icon)
  .use(Stepper)
  .use(Card)
  .use(Button)
  .use(Swipe)
  .use(SwipeItem)
  .use(PullRefresh)
  .use(List)
  .use(Tab)
  .use(Tabs)
  .use(SubmitBar)
  .use(Checkbox)
  .use(CheckboxGroup)
  .use(Skeleton)
  .use(VanImage)
  .use(RadioGroup)
  .use(Radio)
  .use(NoticeBar)
  .use(ActionSheet)
  .use(Cascader)
  .use(Col)
  .use(Row)
  .use(Slider)
  .use(DatePicker)
  .use(Switch)
  .use(Calendar)
  .use(Picker)
  .use(Uploader)
  .use(Tag)
  .use(DropdownMenu)
  .use(DropdownItem)
  .use(Notify)
  .use(ConfigProvider)
  .use(NavBar)
  .use(Area)
  .use(Popover)
  .use(Collapse)
  .use(CollapseItem)
  .use(PickerGroup)
  .use(TimePicker)
  .use(BackTop)
  .use(Progress)
  .use(Tabbar)
  .use(TabbarItem)
  .use(Search)
  .use(FloatingBubble)
  .use(GridItem)
  .use(Grid)
  .use(CountDown)
  .use(Space)
  .use(Rate)
  .use(NumberKeyboard)
  .use(Empty)

app.use(router);
app.use(store);
app.use(pinia)

app.use(i18n);

app.mount("#app");
