I am currently working on developing a food ordering system. My focus is on creating the order history page and implementing infinite loading functionality.
My goal is to display the next five results each time the user clicks the "next" button, in descending order based on the created_at
column.
However, I'm encountering an issue where clicking the "next" button repeatedly only shows the same set of results (sixth to tenth) every time.
I believe utilizing a for loop in my method could help resolve this issue, as I am using Firebase queries in my implementation.
Here is a snippet of my code:
<template>
<div>
// Code continues here...
</div>
</template>
<script>
import CartSmartphone from "@/mobile/CartSmartphone.vue";
import NavbarMobile from "@/components/NavbarMobile.vue";
import FooterMobile from "@/sections/FooterMobile.vue";
import fireApp from '@/plugins/firebase'
const firebase = require("firebase");
require("firebase/firestore");
const db = firebase.firestore();
export default {
name: 'UserSmartphone',
// Components and data methods defined here...
// Mounted and next page function implementation...
}
</script>
In my code, I am fetching data from the OrdersUser
collection and storing it in the history
array. I then render this data in the template section using a loop.