feat(i18n): 管理端与玩家端三语支持(中/英/马来语)
- 管理后台 adminT 文案库、结算与代理端页面、表单校验 - 玩家端 vue-i18n 补全首页/公告/串关与 ms 文案 - Element Plus ms 语言包与共享 locale 工具
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import api from '../api';
|
||||
import { resolveAnnouncements } from '../constants/defaultAnnouncement';
|
||||
|
||||
@@ -20,14 +21,16 @@ function collectAnnouncementLines(data: {
|
||||
}
|
||||
|
||||
export function useAnnouncements() {
|
||||
const items = ref<string[]>(resolveAnnouncements([]));
|
||||
const { t } = useI18n();
|
||||
const items = ref<string[]>(resolveAnnouncements([], t('home.announcement_default')));
|
||||
|
||||
async function load() {
|
||||
const fallback = t('home.announcement_default');
|
||||
try {
|
||||
const { data } = await api.get('/player/home');
|
||||
items.value = resolveAnnouncements(collectAnnouncementLines(data.data));
|
||||
items.value = resolveAnnouncements(collectAnnouncementLines(data.data), fallback);
|
||||
} catch {
|
||||
items.value = resolveAnnouncements([]);
|
||||
items.value = resolveAnnouncements([], fallback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user