You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.8 KiB
Vue

<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 { useTitle } from '/@/hooks/web/useTitle';
import { useLocale } from '/@/locales/useLocale';
import 'dayjs/locale/zh-cn';
import { computed } from 'vue';
import { onBeforeUnmount } 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;
});
const beforeUnloadHandler = (e) => {
if (e) {
e.returnValue = '关闭提示';
}
return '关闭提示';
};
window.addEventListener('beforeunload', beforeUnloadHandler);
onBeforeUnmount(() => {
window.removeEventListener('beforeunload', beforeUnloadHandler);
});
//在onunload函数中执行真正离开前的代码
window.addEventListener('unload', async () => {
try {
} catch (error) {}
});
// Listening to page changes and dynamically changing site titles
useTitle();
</script>
<style lang="less">
.ant-tree.ant-tree-directory .ant-tree-treenode {
width: 100%;
height: 40px;
line-height: 40px;
}
.ant-tree.ant-tree-directory .ant-tree-node-content-wrapper {
height: 40px;
line-height: 40px;
}
.ant-input-affix-wrapper::before {
width: 0;
visibility: hidden;
content: '' !important;
}
</style>