From 3031a7fd3b0c34e88a6ff55dbaafa9b2da65dcb9 Mon Sep 17 00:00:00 2001 From: DEV_DSW <562304744@qq.com> Date: Tue, 2 Jun 2026 10:13:36 +0800 Subject: [PATCH] feat(login): add country flags to login country picker Update the country selection UI to show national flags alongside country names and dial codes. Add a helper function to fetch flag images from flagcdn using country ISO2 codes. Restyle the country picker popup for better layout, and remove the unused selectedCountryDisplay computed property. --- src/pages/login/index.vue | 40 ++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index 0492bcc..b9ba119 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -3,8 +3,15 @@
- + + + @@ -46,13 +53,22 @@
-
-
+
+
-
- +
+ + +
@@ -83,6 +99,12 @@ const languageOptions = [ const currentLocale = computed(() => getCurrentLocale()); const switchLanguage = (locale: string) => setLocale(locale); +function getCountryFlagPngUrl(iso2: string): string { + const country = (iso2 ?? "").trim().toLowerCase(); + if (!/^[a-z]{2}$/.test(country)) return "https://flagcdn.com/w40/un.png"; + return `https://flagcdn.com/w40/${country}.png`; +} + const selectedCountry = ref( findCountryCallingCode( (() => { @@ -98,10 +120,6 @@ const phone = ref(""); const code = ref(""); const phoneSubmitting = ref(false); -const selectedCountryDisplay = computed(() => { - return `${selectedCountry.value.name} (${selectedCountry.value.dialCode})`; -}); - const filteredCountries = computed(() => { const q = countrySearch.value.trim().toLowerCase(); if (!q) {