How can I showcase Vuetify cards in a horizontal row instead of a vertical column?

Currently, I am utilizing Vuetify 1.5 along with the Vuetify grid system to establish my layout structure. Within this setup, I have a component called HelloWorld that I am importing into my Parent Component. The challenge I am facing is that despite setting up the layout in the HelloWorld component, all of the cards are appearing in a column instead of displaying in a single row. I am uncertain where I might be going wrong in this configuration.

In an attempt to render the cards in a single row, I have configured the

<v-layout align-center justify-center row fill-height class="mt-5">
.

You can view the functional example on CodeSandbox.

I have excluded my Vuex store information below as the issue lies within the layout rather than the data itself. For reference, the minimal Vuex store details can be accessed through the provided link above.

This snippet showcases my HellWorld Component:-

<template>
  <v-layout align-center justify-center row fill-height class="mt-5">
    <v-flex xs4>
      <v-card class="mx-4">
        <v-img :src="src"></v-img>
        <v-card-title primary-title>
          <div>{{title}}</div>
        </v-card-title>
      </v-card>
    </v-flex>
  </v-layout>
</template>

<script>
export default {
  name: "HelloWorld",
  props: {
    title: String,
    src: String,
    id: Number
  },
  data() {
    return {};
  }
};
</script>

Furthermore, here is my Parent component snippet:

<template>
  <v-container>
    <v-layout align-center justify-center row fill-height class="mt-5">
      <h2>Parent Component</h2>
    </v-layout>
    <draggable v-model="draggableCards">
      <template v-for="(tech,i) in getCardArray">
        <HelloWorld :src="tech.src" :title="tech.title" :key="i"/>
      </template>
    </draggable>
  </v-container>
</template>

<script>
import { mapGetters, mapMutations } from "vuex";
import HelloWorld from "./HelloWorld";
import draggable from "vuedraggable";
export default {
  components: {
    draggable,
    HelloWorld
  },
  computed: {
    ...mapGetters({
      getCardArray: "getCardArray"
    }),
    draggableCards: {
      get() {
        return this.$store.state.cardArray;
      },
      set(val) {
        this.$store.commit("setCardArray", val);
      }
    }
  },
  methods: {
    ...mapMutations({
      setCardArray: "setCardArray"
    })
  }
};
</script>

In essence, my objective is to showcase the cards in a row format rather than a column arrangement. Any assistance or insights regarding this matter would be greatly appreciated. Thank you! :)

Answer №1

When you are looping through <v-layout>, each iteration creates a new line or layout for a card. To display multiple cards on the same row, move the layout out of the loop and place it in the parent element.

Here is an example:

<draggable v-model="draggableCards">
<v-layout>
      <template v-for="(tech,i) in getCardArray">
        <HelloWorld :src="tech.src" :title="tech.title" :key="i"/>
      </template>
    </v-layout>
    </draggable>

Don't forget to remove from HelloWorld.

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 can I maintain the selected state of checkbox and radio button in ReactJS after page refresh?

I am facing an issue with my multistep form that contains radio buttons and checkboxes from material UI. Although the data is stored correctly in state and local storage, when I move to the next page and then return, the selections appear unselected to the ...

Replace the value within an array

Is there a smart method for substituting or replacing a value within an array? For example: var array = [[1,2,3,'null'],['null',2,3,4],['null','null','null','null'],[1,1,1,1]] The desired outpu ...

Using Angular to dynamically display JSON data on an HTML page

I have JSON data that I need to format into an HTML page where each parent becomes the header and its children are displayed under the same parent in the content area. Another parent will follow with its respective children listed below. How can I achiev ...

Exploring the power of ES6: Breaking down an array filled with objects

So I have this object: const settings = { js: { files: [ { src: './js/app.js', name: 'script.js', dest: 'public_html/js/' }, { ...

What is the best way to showcase JSON data on a webpage?

Currently, I have a total of 3 different objects containing education details in my JSON data. While I am able to display them in the console using a for loop, I am only able to show one object in my HTML output. How can I push all three details to my HTML ...

The React Stripe API is functioning perfectly on local servers but encountering issues in the live environment

Just when I thought I was almost finished, reality hits me hard! My deadline is right around the corner! I finally got everything working on my local machine with a stripe payment form. However, when I pushed it live, I received an error message from my A ...

Attempting to utilize a mongo connection multiple times will result in an error message stating "Unable to use a session that

I'm encountering an obstacle while working with Mongo, here's the situation: const mongoose = require('mongoose'); const CONFIG = { host: "localhost", port: 27017, db: "dev" }; const url = `mongodb://${ ...

Angular - Ensure completion of a function call before continuing with the code execution

I'm currently working on developing a code snippet that checks for potential adverse drug reactions between two medications. Within my checkForClash() function, there is a call to getCollisionsList(), which is responsible for populating the interacti ...

Selecting options in an input field using AngularJS

In my AngularJS template, I have the code snippet below: <input type="number" id="exercise-log-duration-hours-{{ ::$id }}" class="form-control" ng-model="$ctrl.workoutHours" ng-change="$ctrl.updateHours($ctrl.workoutHours)" name ...

React neglecting the path resulting in incorrect menu display

I am facing an issue with my navigation menu setup. I have a menu that displays white links for dark backgrounds, which is used on the homepage, and another menu with dark links used on all other pages. However, when the site is live, React/NextJS seems t ...

Building a Modal in React and Triggering it for Display, followed by Making an AJAX Request upon Submission

Check out my CodePen snippet (minus delete ajax request): http://codepen.io/martincarlin87/pen/KzPWOw I've been diving into the world of React recently, and I'm working on converting a page in my web application to utilize React instead of just ...

What steps do I take to eliminate this additional content?

Currently working on a web messenger project and facing an issue with a specific bar that I want to remove from my interface: https://i.sstatic.net/sp05i.png Within the Home.blade.php file, the code snippet looks like this: @extends('layouts.texter& ...

What could be causing the NaN error when parsing a number in Javascript?

I'm having trouble figuring out why I keep getting a NaN when I try to print a number with JavaScript. This code snippet is used in multiple places on the website and usually works without any issues. The URL where this issue is occurring is: Here ...

Node.js user update complete

I am currently working on enabling users to edit their profiles. However, the code I have set up does not seem to be functioning as expected. The form I am using looks like this: <form action="/dashboard/users/edit/:id" method="put"> And my route ...

image in the background following the header

Live Example: http://jsbin.com/opokev/54 I am currently trying to set this image as the background image while also including a header, but as you can see in the demo, the header is overlapping the image. Is there a way I can rearrange this so that the h ...

Is there a streamlined approach to signal a successful callback to $q.all without the need to define a $q.defer() variable?

Within my application, I have a mixture of synchronous and asynchronous methods. Here is an example of code from one of the controllers: $q.all([ asyncMethod1(), syncMethod1() ]) .then(function (results) { Even though I don't actually need t ...

Guide to setting up sub-routes in fastify

Currently, I am incorporating fastify as the web framework for my nodejs project. My aim is to organize and call all routes from a specific directory while having a base route established in the main JS file, similar to how it's done in express. Despi ...

Utilizing JSON and Javascript to dynamically generate and populate interactive tables

Here's how I've structured my JSON data to define a table: var arrTable = [{"table": "tblConfig", "def": [{"column": "Property", "type": "TEXT NOT NULL"}, {"column": "Value", "type": "TEXT NOT NULL"}], "data": [{"Property ...

Problem with .otherwise when using Angular's UI-Router and passing parameters in the URL

I am facing an issue with searching on my page. Currently, this is the code I have: $stateProvider .state('aaa', { url: '/aaa', templateUrl: 'client/parties/views/aaa.ng.html', controller: 'Aaa' }) ...

Is a component updating an unregulated text input to be controlled?

Whenever I attempt to input information into the form and save it in the state, I encounter the following issue: Warning: A component is converting an uncontrolled text input to a controlled one. Input elements should not transition between being contro ...