From cd2e6c1aaeb59479de145c31912a8a8918d73f7a Mon Sep 17 00:00:00 2001 From: MaysWind Date: Tue, 14 Jan 2025 22:23:24 +0800 Subject: [PATCH] migrate two column select to composition API and typescript --- src/components/desktop/TwoColumnSelect.vue | 341 +++++++++++---------- src/desktop-main.js | 2 - src/locales/helper.js | 8 - src/mobile-main.js | 2 - 4 files changed, 177 insertions(+), 176 deletions(-) diff --git a/src/components/desktop/TwoColumnSelect.vue b/src/components/desktop/TwoColumnSelect.vue index a87dae3b..5073a989 100644 --- a/src/components/desktop/TwoColumnSelect.vue +++ b/src/components/desktop/TwoColumnSelect.vue @@ -20,8 +20,8 @@ {{ selectionPrimaryItemText }} {{ selectionSecondaryItemText }} @@ -32,38 +32,38 @@
+ v-if="selectedPrimaryItem && primarySubItemsField && (selectedPrimaryItem as Record)[primarySubItemsField]"> @@ -73,7 +73,11 @@ - diff --git a/src/desktop-main.js b/src/desktop-main.js index aabd8bc9..da1306b1 100644 --- a/src/desktop-main.js +++ b/src/desktop-main.js @@ -73,7 +73,6 @@ import router from '@/router/desktop.js'; import { getVersion, getBuildTime } from '@/lib/version.ts'; import { getI18nOptions } from '@/locales/helpers.ts'; import { - translateIf, translateError, i18nFunctions } from '@/locales/helper.js'; @@ -473,7 +472,6 @@ app.config.globalProperties.$version = getVersion(); app.config.globalProperties.$buildTime = getBuildTime(); app.config.globalProperties.$locale = i18nFunctions(i18n.global); -app.config.globalProperties.$tIf = (text, isTranslate) => translateIf(text, isTranslate, i18n.global.t); app.config.globalProperties.$tError = (message) => translateError(message, i18n.global.t); app.mount('#app'); diff --git a/src/locales/helper.js b/src/locales/helper.js index e6b8ba5b..ed9e57ce 100644 --- a/src/locales/helper.js +++ b/src/locales/helper.js @@ -1401,14 +1401,6 @@ function initLocale(i18nGlobal, lastUserLanguage, timezone) { return localeDefaultSettings; } -export function translateIf(text, isTranslate, translateFn) { - if (isTranslate) { - return translateFn(text); - } - - return text; -} - export function translateError(message, translateFn) { let parameters = {}; diff --git a/src/mobile-main.js b/src/mobile-main.js index 74436a42..f2c76994 100644 --- a/src/mobile-main.js +++ b/src/mobile-main.js @@ -82,7 +82,6 @@ import '@vuepic/vue-datepicker/dist/main.css'; import { getVersion, getBuildTime } from '@/lib/version.ts'; import { getI18nOptions } from '@/locales/helpers.ts'; import { - translateIf, i18nFunctions } from '@/locales/helper.js'; import { @@ -206,7 +205,6 @@ app.config.globalProperties.$version = getVersion(); app.config.globalProperties.$buildTime = getBuildTime(); app.config.globalProperties.$locale = i18nFunctions(i18n.global); -app.config.globalProperties.$tIf = (text, isTranslate) => translateIf(text, isTranslate, i18n.global.t); app.config.globalProperties.$alert = (message, confirmCallback) => showAlert(message, confirmCallback, i18n.global.t); app.config.globalProperties.$confirm = (message, confirmCallback, cancelCallback) => showConfirm(message, confirmCallback, cancelCallback, i18n.global.t);