139 lines
2.9 KiB
Vue
139 lines
2.9 KiB
Vue
<script setup lang="ts">
|
|
import { ConfigProvider } from 'ant-design-vue/lib';
|
|
import { usePrimaryColor } from '@/hooks/useTheme';
|
|
import zhCN from 'ant-design-vue/lib/locale/zh_CN';
|
|
import enUS from 'ant-design-vue/lib/locale/en_US';
|
|
import dayjs from 'dayjs';
|
|
import 'dayjs/locale/zh-cn';
|
|
import { ref, watch } from 'vue';
|
|
import useAppStore from '@/store/modules/app';
|
|
import useI18n from '@/hooks/useI18n';
|
|
const { t, currentLocale } = useI18n();
|
|
const appStore = useAppStore();
|
|
|
|
dayjs.locale('zh-cn'); // 默认中文
|
|
usePrimaryColor(); // 载入用户自定义主题色
|
|
|
|
let locale = ref(zhCN); // 国际化初始中文
|
|
|
|
// 国际化切换语言
|
|
function fnChangeLocale(v: string) {
|
|
switch (v) {
|
|
case 'zh_CN':
|
|
locale.value = zhCN;
|
|
dayjs.locale(zhCN.locale);
|
|
break;
|
|
case 'en_US':
|
|
locale.value = enUS;
|
|
dayjs.locale(enUS.locale);
|
|
break;
|
|
}
|
|
}
|
|
|
|
// 加载多语言并进行监听
|
|
fnChangeLocale(currentLocale.value);
|
|
watch(currentLocale, val => {
|
|
fnChangeLocale(val);
|
|
});
|
|
|
|
// 输出应用版本号
|
|
console.info(
|
|
`%c ${t('common.title')} %c ${appStore.appCode} - ${appStore.appVersion} `,
|
|
'color: #fadfa3; background: #030307; padding: 4px 0;',
|
|
'color: #030307; background: #fadfa3; padding: 4px 0;'
|
|
);
|
|
</script>
|
|
|
|
<template>
|
|
<ConfigProvider :locale="locale">
|
|
<RouterView />
|
|
</ConfigProvider>
|
|
</template>
|
|
|
|
<style>
|
|
#app {
|
|
height: 100%;
|
|
}
|
|
body .ant-pro-basicLayout {
|
|
display: flex;
|
|
flex-direction: column;
|
|
width: 100%;
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.ant-pro-sider {
|
|
z-index: 20;
|
|
}
|
|
|
|
.slide-left-enter-active,
|
|
.slide-left-leave-active,
|
|
.slide-right-enter-active,
|
|
.slide-right-leave-active {
|
|
transition-duration: 0.5s;
|
|
transition-property: height, opacity, transform;
|
|
transition-timing-function: cubic-bezier(0.55, 0, 0.1, 1);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.slide-left-enter,
|
|
.slide-right-leave-active {
|
|
opacity: 0;
|
|
transform: translate(2em, 0);
|
|
}
|
|
|
|
.slide-left-leave-active,
|
|
.slide-right-enter {
|
|
opacity: 0;
|
|
transform: translate(-2em, 0);
|
|
}
|
|
|
|
/**强制改表格边距 */
|
|
.ant-table.ant-table-small .ant-table-tbody > tr > td,
|
|
.ant-table.ant-table-small .ant-table-thead > tr > th {
|
|
padding: 6px !important;
|
|
}
|
|
|
|
/** ==== 表格头按钮区域 S === **/
|
|
/* 默认 */
|
|
.button-container {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
justify-content: flex-start;
|
|
align-items: left;
|
|
}
|
|
|
|
.button-container > button {
|
|
margin-right: 12px;
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.button-container > button:last-child {
|
|
margin-right: 0;
|
|
}
|
|
/* 平板端 */
|
|
@media (max-width: 992px) {
|
|
.button-container {
|
|
flex-direction: row;
|
|
align-items: flex-start;
|
|
align-items: left;
|
|
}
|
|
.button-container > button {
|
|
margin-right: 12px;
|
|
margin-bottom: 12px;
|
|
}
|
|
}
|
|
/* 手机端 */
|
|
@media (max-width: 576px) {
|
|
.button-container {
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
align-items: left;
|
|
}
|
|
.button-container > button {
|
|
margin-right: 0px;
|
|
margin-bottom: 12px;
|
|
}
|
|
}
|
|
/** ==== 表格头按钮区域 E === **/
|
|
</style>
|