Utilize vuejs transition-group with Bootstrap's grid system

I'm currently attempting to implement vuejs transitions with Bootstrap grids, but it seems to be causing some issues with the grid system. This is because the transition-group feature alters the DOM structure by inserting a new tag between the row and col-md-6 elements. Here's an example:

<div class="row">
  <transition-group name="list">
    <div class="col-md-6" v-for="product in products" :key="product.id">\ 
      My product content here
    </div>
  </transition-group>

As a result of this rendering, the code is altered to look like this:

<div class="row">
  <span>
    <div class="col-md-6" v-for="product in products" :key="product.id">\ 
      My product content here
    </div>
  </span>
</div>

The introduction of the new span element disrupts the grid system as .col-md-6 is no longer a direct child of .row.

Does anyone have suggestions for a workaround that still utilizes Bootstrap grids?

Answer №1

One way to customize the appearance of the transition-group is by adding a class directly.

The default element rendered by the transition-group is a `span`, but this can be changed using the tag attribute. To apply a specific class, such as class="col-md-6", you can do so like this:

<transition-group name="list" tag="div" class="col-md-6"></transition-group>

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

What is the best way to make a canvas element fit the entire browser window without causing scroll bars to appear?

My window size isn't working properly, despite attempting the following code: Javascript var game; function game() { this.canvas = document.getElementById('canvas'); this.canvasWidth = window.innerWidth; this.canvasHeight = wi ...

Perform the action when the button is clicked

I'm struggling with finding a solution to this problem. I have an input field and a submit button. My goal is to update the value of a variable to match the value in the input field when the submit button is clicked. Additionally, I need to execute a ...

ng2-table ways to customize the appearance of a particular row

Hey there, I'm currently new to Angular 2 and working with ng2-table. I've successfully added a table like the one shown here to my website. Now, I'm trying to figure out how to add color to specific rows within the table. Following the ste ...

Altering the JavaScript variable by selecting an option from a dropdown list

After downloading a choropleth map from leafletjs.com, I encountered an issue with multiple JS files labeled by year (e.g. us-states2012.js, us-states2013.js). The challenge now is to implement a drop down menu in such a way that selecting a specific year ...

What is the best way to implement a responsive navigation bar for mobile devices using Bootstrap 4 integrated with Vue

I've been putting in a lot of effort to create a responsive navbar using Bootstrap 4 with Vue. Here is the code in my App.vue file: NavBar <b-navbar-nav> <b-nav-item href="#">Link</b-nav-item> <b-nav-item href="#" disabled ...

HTML: Launch Frameset in a Separate Tab or Window

I have encountered an issue with using FRAMESET. Situation: Within my frameset, I have a menu with 5 links. When I click on the home page, everything looks fine. However, when I open it in a new tab or window, the design is not displayed. Is there a way ...

Using React to Dynamically Display JSON Data as HTML

Struggling to incorporate HTML rendering from JSON data into my React component without relying on dangerouslySetInnerHTML. I want to include other React components within the rendered HTML, but facing challenges when trying to render multiple elements or ...

Ways to detect the use of vue.js on a webpage without relying on vue-devtools

One way to determine if the page is utilizing Angular or AngularJS is by inspecting window.ng and window.angular. Is there a similar method to identify whether Vue is being used on the page directly from the console, without relying on vue-devtools? ...

The skybox in Three.JS is not appearing. Could there be an issue with the sizing or positioning?

Incorporating a small three.js scene into my project has been a challenge. I managed to create a skybox for the scene, but it's not appearing as expected. Interestingly, when I added a small box to the scene, it rendered perfectly. I suspect that the ...

The Radio button and Checkbox values are causing an issue where the Radio button is continuously summing upon clicking without a limit. Why is this happening? Check out

I'm currently stuck in a function and believe it would be helpful for you to guide me along the correct path. My goal is to sum the values of checked boxes with the values of checked radio buttons. However, the radio values are continuously accumulat ...

Troubleshooting Challenges with JavaScript DOM Manipulation

I am facing an issue with a table where I need the first column to remain fixed when scrolling horizontally. The code snippet below works perfectly for the first column of td's, but fails to work for the tr's. Despite checking the code thoroughly ...

Responsive flex elements in a single line

I am facing a challenge with five divs that I want to display inline and make them responsive. The issue is that when the window size changes, they end up getting squished together instead of breaking into a new row as desired. I have tried various methods ...

Leveraging CSS classes for enhancing the bootstrap grid system

Forgive me for the seemingly simple question, but here is my dilemma. Presented below is the current html code: <div class="col-xs-12 col-md-6 col-lg-4"> ...stuff </div> I am wondering how to achieve the following transformation: index ...

The sticky top feature of the Bootstrap 4 navbar does not function properly when it is nested inside a div

I am just getting started as a beginner working on a Web application and utilizing Bootstrap 4 for my web design. I have a quick question that needs some clarification. When the code is structured like this, the Navbar does not stay fixed at the top: < ...

I want to import JSON information from a file to display on my website

I am trying to implement a JSON array on my webpage when a button or image is clicked. Here is the array I have: var products = [ { "productID":"1", "name":"Stark Navy", "url": "stark.jpg", "description": "Waterproof, double velcro straps", "price": " ...

How to eliminate the Horizontal ScrollBar in Telerik RadTextBox specifically for IE users

How can I prevent a TextBox control from overflowing and displaying a horizontal scroll bar without using javascript? I have already tried Wrap="true" along with other methods, but to no avail. <telerik:RadTextBox ID="tx_Subj" Runat="server" TextMod ...

Guide on Hiding the First TD Element in the Second TR Using Display None

Looking to hide the first td of the second row in the table below with a class of "visi". Any suggestions on how to achieve this? .visi{ display:none;} <table border="1" cellpadding="1"> <tr> <td class="visi" rowspan="2">__</td> ...

Out of the DIVs floating left and right, which one is positioned first?

Is the order of <div> elements in HTML important? If it is, what is the reason behind it? .float-left{float:left;} .float-right{float:right;} <div> <div class="float-left">Left</div> <div class="float-right">Right</ ...

Tag - A guide on setting the required attribute for a tag

Currently, I am utilizing Jquery Tag it in order to manage tags and save the values in a database. My challenge lies in using jQuery to make the myTags field required, ensuring that at least one tag is added before proceeding with the save operation. This ...

Mobile browser registers double click/tap event

My mobile web application has a feature where clicking a button will automatically create a team of players for you. If you don't have any players in your team yet, you won't receive a warning. However, if there are already players in your team, ...