fix: gamecarousel not resizing

This commit is contained in:
Huskydog9988
2025-04-07 16:57:44 -04:00
parent f9b774ddb5
commit e572b61af9

View File

@ -37,13 +37,22 @@ const games: Ref<Array<SerializeObject<Game> | undefined>> = computed(() =>
.map((_, i) => props.items[i]) .map((_, i) => props.items[i])
); );
const singlePage = ref(1); const singlePage = ref(2);
const sizeOfCard = 192 + 10; const sizeOfCard = 192 + 10;
onMounted(() => { const handleResize = () => {
singlePage.value = singlePage.value =
(props.width ?? (props.width ??
currentComponent.value?.parentElement?.clientWidth ?? currentComponent.value?.parentElement?.clientWidth ??
window.innerWidth) / sizeOfCard; window.innerWidth) / sizeOfCard;
};
onMounted(() => {
handleResize();
window.addEventListener("resize", handleResize);
});
onBeforeUnmount(() => {
window.removeEventListener("resize", handleResize);
}); });
</script> </script>