Navigating through pages using Nuxt UI-pagination

Having some trouble with setting up the pagination feature from Nuxt UI. Despite trying to research through documentation and videos, I can't seem to figure out how to connect my data to the component.

<template>
        <div>
            <ul class="p-5">
            <li v-for="creator in creators" class="mb-5"gt;
                <nuxt-link
                :key="creator.id"
                :to="`/creator/${creator.slug}`>
                <div class="creatorCard" :style="{ background: `url(${creator.banner}) center center no-repeat`, backgroundSize: `100% auto` }>
                    <div class="glassEffect">
                        <div class="text pl-5 items-end h-1 pb-2">
                            <p class="font-bold">{{ creator.label }}</p>
                            <p class="italic">{{ creator.ig }}</p>
                        </div>
                    </div>
                </div>
            </nuxt-link>
        </li>
    </ul>
    <div class="pb-4">
        <UPagination :ui="{ wrapper: 'justify-center'}" v-model="page" :page-count="7" :total="creators.length" />
    </div>
</div>
</template>


<script setup lang="ts">
const page = ref(1);

const creators = useCreators();

useHead({
  title: 'Creators',
})
</script>

Answer №1

Connect the meta data to the component properties and incorporate the @click event on the <UPagination> element. Utilize the v-model to retrieve the value from the component and send it to the GET method for data retrieval.

Below is a simple example of how this can be implemented:

<UPagination 
  :ui="{ wrapper: 'justify-center'}" 
  v-model="page" 
  :page-count="meta.per_page" 
  :total="meta.total"
  @click="update"
/>
const page = ref(1);
const creators = useCreators(page.value);
        
function update(){
  const creators = useCreators(page.value);
}
   

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Initialization of Masonry JS occurs prior to images being fully loaded

I am in the process of creating a website to serve as my portfolio for university applications. Despite my efforts, I am struggling with the javascript aspect and have not been successful in resolving the issue by following similar inquiries. The problem ...

Having difficulty executing the command 'npm install -g expo-cli'

When attempting to execute npm install - g expo-cli on a Windows 10 machine, I am encountering issues. An error message keeps popping up and preventing me from proceeding. I'm in desperate need of assistance! npm WARN deprecated <a href="/cdn-cgi/ ...

Tips for aligning meshes to the left and ensuring responsiveness in three.js

Currently working on a website using three.js, I'm facing an issue where I can't seem to align and make the mesh responsive simultaneously. My current approach to alignment is: cube.position.x = -20 However, when I try resizing the window, the m ...

To enable the description p tag only when the search box text matches the search criteria, otherwise keep the p tag disabled

I need to develop a search feature that includes a search box, a heading, and a paragraph description. Initially, the description should be hidden, but when a user enters text that matches the description, the paragraph tag should become visible. An exampl ...

V-model prevents checkbox from being checked upon clicking

codesandbox: https://codesandbox.io/s/github/Tapialj/AimJavaUnit6?file=/src/frontend/src/components/AddMovieForm.vue I am currently working on implementing a feature where I need to collect an array of selected actors using checkboxes. I have set up a v-m ...

Interpolating UV is not allowed: 'flat': Using a reserved word in an illegal manner

As a beginner, I recently learned that UV coordinates are not interpolated in WebGL, allowing for exact pixel values to be retrieved. However, when attempting to use the 'flat' keyword, I encountered an error. By adding 'flat' before t ...

Dynamically changing the borders of WebGL canvases: a guide to adding and

Here is my code snippet for creating an HTML canvas: <canvas id="glCanvas" class="canvases" width="20" height="20></canvas> To set the color, I am using the following: gl.clearColor(0.0, 0.0, 0.0, 1.0); gl.clear(gl.COLOR_BUFFER_BIT); I am w ...

Explore the properties within an array of objects through iteration

Here is the array I'm working with: const myArray = [{ id: 1, isSet: true }, { id: 2, isSet: false }, ...]; I only need to iterate over the isSet properties of the objects, ignoring all other properties. Initially, I attempted the following solution ...

Transforming NodeJS Express HTTP responses into strings for AngularJS consumption

I have been working on creating an AngularJS program that communicates with an Express/Node.js API and a MySQL database. On the login page, I am successfully able to call the API which connects to MySQL. Depending on the correct combination of username an ...

A guide on implementing a .click function with jQuery

I have a code snippet that is supposed to add 100 to a number in a MySQL table when a button is clicked. However, the code does not work as expected. When I click the button, nothing happens, but if I refresh the page, it adds 100 to the number. Can some ...

AngularJS is throwing a $injector:modulerr error and I've exhausted all possible solutions

I recently started learning Angular and I've been following the tutorial on the official AngularJS website. Here's what I've tried so far: Installed angular-route and included the script below angular.min.js Utilized ngRoute in my mod ...

Vue is refusing to display information for a certain API call

Within my next component, I have the following structure: <template> <div class="home"> <div class="container" v-if="data" > <Card v-for="result in data" :img="result.links[0]&q ...

Inquiries regarding node.js

While delving into research on node.js and Mongodb, I encountered a few areas that require clarification. My aim is to query Mongodb from the web using JavaScript because of my familiarity with the language. Additionally, it aligns well with Mongodb' ...

What is the best way to divide a string into chunks of no more than 2000 characters each at the end of

Here is a brief excerpt from a string variable labeled results ... 2017-09-18 920.0100 922.0800 910.5999 915.0000 1294800 2017-09-15 924.6599 926.4899 916.3599 920.2899 2505400 2017-09-14 931.2500 932.7700 924.0000 925.1099 1397600 2017-09- ...

I am encountering an error with an Unhandled Promise Rejection, but I am unable to determine the reason behind it

const express = require('express'); const cors = require('cors'); const massive = require('massive'); const bodyParser = require('body-parser'); const config = require('../config'); const app = express(); ...

JavaScript's Set data structure does not allow for the storage of strings

As I retrieve a collection of data consisting of questions from mongoDB, I am attempting to place them in a random question set. However, the set is not accepting any input and is returning empty. module.exports.java = async (req, resp) => { // const ...

Generate Random Quotes - Each new quote should be different from the previous one

As I tackle the FreeCodeCamp 'Random Quote Machine' front end library project using React JSX, everything seemed to be running smoothly except for one major issue - the same quote was often generated two or three times in a row. Obviously, this i ...

Unable to use NodeJS await/async within an object

I'm currently developing a validation module using nodeJs and I'm facing difficulties understanding why the async/await feature is not functioning correctly in my current module. Within this module, I need to have multiple exports for validation ...

Guide on how to modify the color of a single row within a table with just a click

My table structure is as follows: <table> <tr> <td>A1</td> <td>A2</td> <td>A3</td> <td>A4</td> </tr> <tr> ...

Guide to eliminating the clearable icon in the Vuetify file input

I am struggling to find any props to deactivate the clearable icon. Additionally, there doesn't seem to be an event related to this issue. Is there a method available to eliminate the clearable icon? <v-file-input ref="profilePictureFileInput" ...