From 41196b4a2301fcf7d2f524dff825323efca5f045 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Thu, 5 Dec 2024 10:12:18 -0300 Subject: [PATCH] VnSelect loading --- src/components/common/VnSelect.vue | 30 ++++++++++++++++++++---------- src/pages/Ecomerce/CatalogView.vue | 3 ++- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index 24b82017..c4a3e1df 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -129,17 +129,20 @@ async function filterHandler(val, update) { if (!$props.defaultFilter) return update(); const newOptions = filter(val, myOptionsOriginal.value); - update( - () => { - myOptions.value = newOptions; - }, - ref => { - if (val !== '' && ref.options.length > 0) { - ref.setOptionIndex(-1); - ref.moveOptionSelection(1, true); + + setTimeout(() => { + update( + () => { + myOptions.value = newOptions; + }, + ref => { + if (val !== '' && ref.options.length > 0) { + ref.setOptionIndex(-1); + ref.moveOptionSelection(1, true); + } } - } - ); + ); + }, 300); } @@ -178,6 +181,13 @@ async function filterHandler(val, update) { > + diff --git a/src/pages/Ecomerce/CatalogView.vue b/src/pages/Ecomerce/CatalogView.vue index eea285cb..831d79dc 100644 --- a/src/pages/Ecomerce/CatalogView.vue +++ b/src/pages/Ecomerce/CatalogView.vue @@ -760,7 +760,8 @@ const getSubcategories = async () => { DROP TEMPORARY TABLE tmp.itemAvailable;`, { orderId: basketOrderId.value } ); - itemSubcategories.value = res.results[1].data; + const filtered = res.results[1].data.filter(item => item.category); + itemSubcategories.value = filtered.map(i => i.category); } catch (error) { console.error('Error getting subcategories:', error); }