mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-10 04:22:09 +10:00
fix: gamecarousel not resizing
This commit is contained in:
@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user