code refactor

This commit is contained in:
MaysWind
2023-07-17 23:13:54 +08:00
parent f0ef9ad51e
commit 714933df56
9 changed files with 43 additions and 63 deletions
+5 -9
View File
@@ -48,7 +48,7 @@
@click="changeLanguage(locale)"
>
<template #after>
<f7-icon class="list-item-checked-icon" f7="checkmark_alt" v-if="$i18n.locale === locale"></f7-icon>
<f7-icon class="list-item-checked-icon" f7="checkmark_alt" v-if="currentLanguageCode === locale"></f7-icon>
</template>
</f7-list-item>
</f7-list>
@@ -94,15 +94,11 @@ export default {
&& this.$user.getWebAuthnCredentialId()
&& webauthn.isSupported();
},
currentLanguageCode() {
return this.$locale.getCurrentLanguageCode();
},
currentLanguageName() {
const currentLocale = this.$i18n.locale;
let lang = this.$locale.getLanguageInfo(currentLocale);
if (!lang) {
lang = this.$locale.getLanguageInfo(this.$locale.getDefaultLanguage());
}
return lang.displayName;
return this.$locale.getCurrentLanguageDisplayName();
}
},
methods: {