On the browser" /> On the browser" /> On the browser"/>

Vue 3 component not rendering on the page

26 Views Asked by At

I have this Vue 3 Pagination component where I'm getting data from Laravel 10.

<Pagination :links="products.data.links" class="mt-6" />

On the browser I can see this component when I inspect elements, but, nothing really comes on the browser visually. The component basically meant to display the pagination links with the HTML generated.

enter image description here

My Pagination.vue as follows:

<script>
export default {
  props: {
    links: Object
  }
};
</script>

<template>
  <div>
    <Component
        :is="link.url ? 'Link' : 'span'"
        v-for="link in links"
        :href="link.url"
        :html="link.label"
        class="px-1"
        :class="{ 'text-gray-500': ! link.url, 'font-bold' : link.active }"
    />
  </div>
</template>

Just FYI the Laravel index() function to generate the data as follows:

    public function index(): JsonResponse
    {
        $products = Product::paginate(4);
        return response()->json($products);
    }

The JSON generated by the Laravel code can be found here

Anyone got any idea why this is not rendering the elements on the page ?. Thanks.

0

There are 0 best solutions below