fix langs
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
<UButton color="neutral" variant="subtle" trailing-icon="i-lucide-chevron-down"
|
||||
class="bg-bg-light dark:bg-bg-dark m-0 ring-0 text-xl font-medium uppercase cursor-pointer hover:bg-inherit text-text-light dark:text-text-dark"
|
||||
block @click="isOpen = !isOpen">
|
||||
{{ menuStore.selectedCountry }}/{{ menuStore.selectedCurrency?.iso_code }}
|
||||
{{ $session.cookieData.value.country.iso_code }}/{{ $session.cookieData.value.currency.iso_code }}
|
||||
</UButton>
|
||||
|
||||
<div class="absolute ring-0 top-12 p-0 m-0 border-none w-48 z-50" v-if="isOpen">
|
||||
@ -15,7 +15,7 @@
|
||||
class="bg-inherit w-full ring-0 cursor-pointer focus:ring-0 outline-none focus-visible:ring-0 space-y-1">
|
||||
<div class="p-0" @click="openDrop('country')">
|
||||
<div class="flex items-center gap-2 text-xl font-medium uppercase text-text-light dark:text-text-dark">
|
||||
{{ menuStore.selectedCountry }} <span> <i
|
||||
{{ $session.currentCountryIso }} <span> <i
|
||||
class="uil uil-angle-down text-2xl font-light cursor-pointer"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
@ -23,12 +23,9 @@
|
||||
<div v-if="dropCountry"
|
||||
class="rounded-[5px] data-highlighted:not-data-disabled:before:bg-button/50 bg-inherit ring-0 cursor-pointer w-full focus:ring-0 outline-none focus-visible:ring-0 border border-button py-[10px] px-[5px]">
|
||||
<div class="overflow-auto h-[200px] w-full">
|
||||
<p @click="() => {
|
||||
menuStore.selectedCountry = item.iso_code
|
||||
dropCountry = false
|
||||
}"
|
||||
<p @click="() => { $session.setCountry(item.iso_code); $session.loadSession(); dropCountry = false }"
|
||||
class="w-full hover:bg-block dark:hover:bg-button pl-2 py-2 text-base text-text-light dark:text-text-dark rounded-[5px]"
|
||||
v-for="item in menuStore.countryList">
|
||||
v-for="item in menuStore.countries" :key="item.iso_code">
|
||||
{{ item?.name }}
|
||||
</p>
|
||||
</div>
|
||||
@ -41,7 +38,7 @@
|
||||
class="bg-inherit w-full ring-0 cursor-pointer focus:ring-0 outline-none focus-visible:ring-0 space-y-1">
|
||||
<div class="p-0" @click="openDrop()">
|
||||
<div class="flex items-center gap-2 text-xl font-medium uppercase text-text-light dark:text-text-dark">
|
||||
{{ menuStore.selectedCurrency?.iso_code }}<span> <i
|
||||
{{ $session.currentCurrencyIso }}<span> <i
|
||||
class="uil uil-angle-down text-2xl font-light cursor-pointer"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
@ -49,12 +46,9 @@
|
||||
<div v-if="dropCurrency"
|
||||
class="rounded-[5px] data-highlighted:not-data-disabled:before:bg-button/50 bg-inherit ring-0 cursor-pointer w-full focus:ring-0 outline-none focus-visible:ring-0 border border-button py-[10px] px-[5px]">
|
||||
<div class="overflow-auto w-full">
|
||||
<p @click="() => {
|
||||
menuStore.selectedCurrency = item
|
||||
dropCurrency = false
|
||||
}"
|
||||
<p @click="() => { $session.setCurrency(item.iso_code); $session.loadSession(); dropCurrency = false }"
|
||||
class="w-full hover:bg-block dark:hover:bg-button pl-1 py-2 text-base text-text-light dark:text-text-dark rounded-[5px]"
|
||||
v-for="item in menuStore.currencies">
|
||||
v-for="item in menuStore.currencies" :key="item.iso_code">
|
||||
{{ item?.name }}
|
||||
</p>
|
||||
</div>
|
||||
@ -69,6 +63,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onClickOutside } from "@vueuse/core";
|
||||
const {$session} = useNuxtApp();
|
||||
|
||||
const isOpen = ref(false);
|
||||
const menuStore = useMenuStore();
|
||||
|
||||
@ -87,22 +83,6 @@ function openDrop(type?: string) {
|
||||
}
|
||||
}
|
||||
|
||||
watchEffect(() => {
|
||||
if (
|
||||
!menuStore.selectedCountry &&
|
||||
menuStore.countryList &&
|
||||
menuStore.countryList.length > 0
|
||||
) {
|
||||
menuStore.selectedCountry = menuStore.countryList[0].iso_code;
|
||||
}
|
||||
if (
|
||||
!menuStore.selectedCurrency &&
|
||||
menuStore.currencies &&
|
||||
menuStore.currencies.length > 0
|
||||
) {
|
||||
menuStore.selectedCurrency = menuStore.currencies[0];
|
||||
}
|
||||
});
|
||||
|
||||
onClickOutside(dropdownRef, () => {
|
||||
isOpen.value = false
|
||||
|
Reference in New Issue
Block a user