feat: 帮助文档多语言文件上传

This commit is contained in:
TsMask
2023-11-24 14:20:59 +08:00
parent 030254db4e
commit 627e579729
8 changed files with 140 additions and 109 deletions

View File

@@ -3,11 +3,24 @@ import useAppStore from '@/store/modules/app';
import useI18n from '@/hooks/useI18n';
import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';
const { t } = useI18n();
import { computed } from 'vue';
const { t, currentLocale } = useI18n();
const appStore = useAppStore();
const route = useRoute();
const docUrl = appStore.getHelpDoc;
const height = ref<string>(document.documentElement.clientHeight + 'px');
// 文档地址
const docUrl = computed(() => {
let url = appStore.getHelpDoc;
if (url.indexOf('{language}') === -1) {
return url;
}
// 语言参数替换
const local = (route.query.language as string) ?? currentLocale.value;
const lang = local.split('_')[0];
return url.replace('{language}', lang);
});
/**
* 国际化翻译转换
*/