From 1006382a624f75220216113463f7efb9fe57afa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E4=BB=A3=E7=B6=BA=E5=87=9B?= Date: Mon, 28 Oct 2024 18:30:11 +0800 Subject: [PATCH] fix: allow empty text --- src/utils/ceobeCanteen.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/ceobeCanteen.js b/src/utils/ceobeCanteen.js index 206b98c1..8edcddd8 100644 --- a/src/utils/ceobeCanteen.js +++ b/src/utils/ceobeCanteen.js @@ -3,8 +3,11 @@ import { computed, inject } from 'vue'; export const useCeobeApiUtils = () => { const isLocaleZH = computed(() => inject('getRoot')?.()?.$root.localeZH); + /** + * @returns {string} + */ const getLocalizedText = obj => - obj[isLocaleZH.value ? 'zh_CN' : 'en_US'] || obj.zh_CN || obj.en_US || ''; + obj[isLocaleZH.value ? 'zh_CN' : 'en_US'] ?? obj.zh_CN ?? obj.en_US ?? ''; return { isLocaleZH,