VnSelect loading

This commit is contained in:
William Buezas 2024-12-05 10:12:18 -03:00
parent 65923fee9f
commit 41196b4a23
2 changed files with 22 additions and 11 deletions

View File

@ -129,17 +129,20 @@ async function filterHandler(val, update) {
if (!$props.defaultFilter) return update(); if (!$props.defaultFilter) return update();
const newOptions = filter(val, myOptionsOriginal.value); const newOptions = filter(val, myOptionsOriginal.value);
update(
() => { setTimeout(() => {
myOptions.value = newOptions; update(
}, () => {
ref => { myOptions.value = newOptions;
if (val !== '' && ref.options.length > 0) { },
ref.setOptionIndex(-1); ref => {
ref.moveOptionSelection(1, true); if (val !== '' && ref.options.length > 0) {
ref.setOptionIndex(-1);
ref.moveOptionSelection(1, true);
}
} }
} );
); }, 300);
} }
</script> </script>
@ -178,6 +181,13 @@ async function filterHandler(val, update) {
> >
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" /> <slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
</template> </template>
<template #no-option>
<QItem>
<QItemSection class="text-grey">
{{ t('emptyList') }}
</QItemSection>
</QItem>
</template>
</QSelect> </QSelect>
</template> </template>

View File

@ -760,7 +760,8 @@ const getSubcategories = async () => {
DROP TEMPORARY TABLE tmp.itemAvailable;`, DROP TEMPORARY TABLE tmp.itemAvailable;`,
{ orderId: basketOrderId.value } { 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) { } catch (error) {
console.error('Error getting subcategories:', error); console.error('Error getting subcategories:', error);
} }