<template>
  <ConfigProvider :locale="antdLocal">
    <AppProvider>
      <RouterView />
    </AppProvider>
  </ConfigProvider>
</template>

<script lang="ts" setup>
  import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN';
  import en from 'ant-design-vue/lib/locale-provider/en_US';
  import zhTW from 'ant-design-vue/lib/locale-provider/zh_TW';
  import { ConfigProvider } from 'ant-design-vue';
  import { AppProvider } from '/@/components/Application';
  import { useTitle } from '/@/hooks/web/useTitle';
  import { useLocale } from '/@/locales/useLocale';

  import 'dayjs/locale/zh-cn';
  import { computed } from 'vue';
  // support Multi-language
  const { getLocale } = useLocale();

  const antdLocal = computed(() => {
    if (getLocale.value === 'zh_CN') {
      return zhCN;
    }
    if (getLocale.value === 'en') {
      return en;
    }
    if (getLocale.value === 'zh_TW') {
      return zhTW;
    }
    return zhCN;
  });

  // Listening to page changes and dynamically changing site titles
  useTitle();
</script>
<style lang="less" scoped>
  :deep(.ant-tree-treenode),
  :deep(.ant-tree-node-content-wrapper) {
    width: 100%;
    height: 35px;
    line-height: 35px;
  }

  :deep(.ant-tree .ant-tree-node-content-wrapper) {
    height: 35px;
    line-height: 35px;
  }
</style>
