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();
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);
}
</script>
@ -178,6 +181,13 @@ async function filterHandler(val, update) {
>
<slot :name="slotName" v-bind="slotData ?? {}" :key="slotName" />
</template>
<template #no-option>
<QItem>
<QItemSection class="text-grey">
{{ t('emptyList') }}
</QItemSection>
</QItem>
</template>
</QSelect>
</template>

View File

@ -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);
}