27 lines
783 B
Svelte
27 lines
783 B
Svelte
<script lang="ts">
|
|
import { onMount } from "svelte";
|
|
|
|
let {currentPag,
|
|
cantpag,
|
|
queryPag
|
|
}:{
|
|
currentPag: number,
|
|
cantpag: number,
|
|
queryPag: (a:number) => void} = $props();
|
|
|
|
let array = $derived.by(()=> Array.from({ length: cantpag }, (_, i) => i + 1));
|
|
</script>
|
|
|
|
{#if cantpag>0}
|
|
<nav aria-label="Page navigation example">
|
|
<ul class="pagination">
|
|
{#each array as num }
|
|
{#if currentPag !== num}
|
|
<li class="page-item"><a class="page-link" href="#" onclick={()=>queryPag(num)}>{String(num)}</a></li>
|
|
{:else}
|
|
<li class="page-item"><a class="page-link active" href="#" onclick={()=>queryPag(num)}>{String(num)}</a></li>
|
|
{/if}
|
|
{/each}
|
|
</ul>
|
|
</nav>
|
|
{/if} |