HOTFIX: OrderCatalog scroll To Item #1026
|
@ -78,17 +78,16 @@ watch(
|
|||
{ immediate: true }
|
||||
);
|
||||
const onItemSaved = (updatedItem) => {
|
||||
scrollToItem(updatedItem.items[0].itemFk);
|
||||
requestAnimationFrame(() => {
|
||||
scrollToItem(updatedItem.items[0].itemFk);
|
||||
});
|
||||
};
|
||||
|
||||
const scrollToItem = async (id) => {
|
||||
|
||||
await nextTick();
|
||||
setTimeout(() => {
|
||||
const element = itemRefs.value[id]?.$el;
|
||||
if (element) {
|
||||
element.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
}, 100);
|
||||
const element = itemRefs.value[id]?.$el;
|
||||
if (element) {
|
||||
element.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
};
|
||||
provide('onItemSaved', onItemSaved);
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue
Y si lo tuviese que cargar tardase 101ms ya no iria?
Le puse el nextTick para que el DOM terminase de montarse pero no terminaba de funcionar
Con el setTimeout conseguí el efecto deseado
Iría de todas maneras porque el timeout no depende de la petición anterior
https://chatgpt.com/c/675000bd-53e8-8011-8a7a-0481f274180d
Resuelto con requestAnimationFrame
He usado un console.error y solo se muestra 1 vez