connected to new url param
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
// imports
|
||||
|
||||
import { useAppParams } from "~/composables/global/useAppParams";
|
||||
import { useRatio } from "~/composables/global/useRatio";
|
||||
|
||||
// types
|
||||
@@ -20,27 +21,9 @@ defineProps<Props>();
|
||||
|
||||
// state
|
||||
|
||||
const params: any = inject("params");
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const { page } = useAppParams();
|
||||
|
||||
const { isMobile } = useRatio();
|
||||
|
||||
const { y } = useWindowScroll({ behavior: "smooth" });
|
||||
|
||||
// computed
|
||||
|
||||
const page = computed({
|
||||
get: () => (route.query["page"] ? Number(route.query["page"]) : 1),
|
||||
set: (value: number) => {
|
||||
params.page = value;
|
||||
router.push({
|
||||
query: { ...route.query, page: value },
|
||||
});
|
||||
y.value = 0;
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user