Having trouble with the alignment of items in Vue?

Currently, I am using the Vue framework in combination with Vuetify library to develop a web page. The main issue I am facing is related to card alignment on the page. When there are only a few cards displayed, the alignment looks perfect but if the number of cards increases to around 10 or more, the layout starts to look distorted.

https://i.stack.imgur.com/NeHgo.png

<template>
<div class="d-flex justify-center mb-6 mt-10">

    <v-card
      class="mr-4 ml-4"
      v-for="(cat, index) in cards"
      :key="index"
      outlined
    >
      <v-card-actions>
        <v-btn @click="getdata(cat._id)" plain>
          {{ cat.category }}
        </v-btn>
      </v-card-actions>
    
  </v-card>
</div>

Answer №1

In order to prevent overflow, make sure to include the flex-wrap class to ensure items display on a new line.

// (...)
<div class="d-flex justify-center flex-wrap mb-6 mt-10">
// (...)

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

How do I test Pinia by calling one method that in turn calls another method, and checking how many times it has been called

As I embark on my journey with Vue 3 and Pinia, a particular question has been lingering in my mind without a concrete answer thus far. Let's delve into the crux of the matter... Here's an example of the store I am working with: import { ref, co ...

Mastering the use of Quasar variables in your scss styles is crucial for optimizing your

I recently set up a project using Vue3 and Quasar by running vue add quasar. However, I am struggling to figure out how to utilize Quasar sass/scss variables. According to the documentation, I should use the following syntax: <style lang="scss&quo ...

What is the best way to handle asynchronous requests in frontend development with Nuxt.js?

Recently delving into Vue and Nuxt, I have been grappling with a query surrounding asynchronous requests. My understanding so far is that utilizing asyncData along with axios in Nuxt allows for fetching data that can be showcased on the frontend. However, ...

Is there a way to access the body html element within a template in vue.js?

I'm struggling to add styles to the body element of my HTML page. It seems like I can't access it directly from the template because there's another body element nested inside the main body. Even when I try to change the style using JavaScri ...

How can I incorporate a script from the node_modules directory into a VueJS project?

Whenever a node_module is installed, the corresponding folder is automatically added inside the node_module directory of my application. Now, I am looking to include a script that resides within an installed module, such as .. installed_module/dist/ How d ...

Instead of utilizing components, consider using multiple Vue instances for a more streamlined

I'm currently working on updating an old .NET MVC project that utilizes HTML, Bootstrap, and jQuery for its Views. I've decided to switch from jQuery to Vue.JS, but I'm struggling to determine the best approach. Since all the views are uniq ...

looking to display the latest status value in a separate component

I am interested in monitoring when a mutation is called and updates a status. I have created a component that displays the count of database table rows when an API call is made. Below is the store I have implemented: const state = { opportunity: "" } ...

Update: When a variable changes during onUploadProgress in Vue.js, the DOM is not re

Having a bit of an issue here. I'm working on an app where users can upload images using axios. In order to enhance the user experience, I'm trying to implement a loading bar. Here's what it looks like: <div class="loadingbox" :style="{ ...

Unable to assign Axios response data to the data property of a Vue instance

I'm having trouble assigning an array of data fetched by axios to the bookList variable in my vue.js project. Despite my efforts, bookList remains empty ([]). Can anyone help me understand why this is happening? export default { ... data () { retur ...

Learn how to reference a parameter within the meta title of a route in Vue.js

I'm encountering an issue when attempting to call a parameter in the meta title route, I've already attempted this method but it's still not working { path: '/test/blog/:slug', name: 'Surah', component: Surah ...

Should Vue be reset before each Jest test?

I am currently working with Vue JS using @vue/test-utils and jest for my testing. In my tests, I call the following: let localVue = createLocalVue(); vueMount(MyComponent, { localVue: localVue, options }); The issue arises when referencing libraries that ...

What is the best way to create a list from a matrix using JavaScript?

I have an array structured as follows: const input_array= [ ["red", "green"], ["small", "medium"], ["x", "y", "z"] //... can have any number of rows added dynamically ...

Vue component does not inherit scoped CSS

One issue I encountered involves a scoped style tag in my Vue component: <style scoped> .ttt{ background-color: red; } </style> After building the project with npm and webpack, the styles were not being copied over. To address ...

Tips for transforming a JSON response into an array with JavaScript

I received a JSON response from an API: [ { "obj_Id": 66, "obj_Nombre": "mnu_mantenimiento_de_unidades", "obj_Descripcion": "Menu de acceso a Mantenimiento de Unidades" }, { "obj_Id": 67, "ob ...

Is it possible to modify the font style with a click in Vue.js?

I am currently working on a Vuejs website with vuetify components and have successfully implemented two languages using Internationalization (i18n). However, I am facing an issue where I need to change the font when switching to the second language and I&a ...

While making a promise, an error occurred: TypeError - Unable to access the property '0' of null

I encountered an issue when trying to assign data from a function. The error appears in the console ((in promise) TypeError: Cannot read property '0'), but the data still shows on my application. Here is the code: <template> ...

Implementing pagination in Nuxt using asyncData

Wondering if it's possible to implement pagination using asyncData in Nuxt? Here is the code snippet I have: <template> <v-container fluid> <v-row> <v-col v-for="sessao in sessoes" :key=" ...

VueJS List Animations: JavaScript hooks not triggered for all elements in the list

I've arranged a grid of divs in rows and columns, along with a transition group that looks like this: <div class="row" v-for="row in grid"> <div class="col-md-3" v-for="col in row"> <transition-group v- ...

I'm encountering a problem with my vuejs application

I am currently working on a new vuejs 2 app and encountered an unexpected error. ERROR in ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!./src/components/Customers.vue Module build failed: S ...

Vue.js creates a new row in the table with an undefined array of data

Trying to create a new row when clicking "+" using Vue Js Encountering an error: tablerows is not defined Vue.component('inp-row', { props: ['data'], template: `<tr :id="data.row_id" ><td> 1</td><td>2 < ...