Warning in Vue.js: Duplicate keys with the value of '0' have been detected, which could potentially lead to update errors. This issue was found within the Vue.js Bootstrap collapse

When trying to create a collapsed card with Bootstrap 4 and Vue.js, I encountered some issues. Bootstrap 4 was functioning properly without Vue.js, maintaining the proper transitions and not expanding cards that were not clicked. However, after moving my code into Vue, I noticed that when clicking a button, both the desired card and other undesired cards were opening. Additionally, the transition effects were completely non-functional in Vue.js. The console displayed the following error:

vue.runtime.esm.js?2b0e:619 [Vue warn]: Duplicate keys detected: '0'. This may cause an update error.
    
found in
    
---> <Beginner> at src/views/beginner.vue
       <App> at src/App.vue
         <Root>

This is what I attempted:

prices.vue

<template>
<div class="prices">
  <div class="container">
    <h1 class="comfortHeader" id="comfortHeader" style="margin-bottom: 50px;">Our Prices</h1>
    <!-- Rest of the HTML code goes here -->
  </div>
</div>

</template>

<script>
  import $ from 'jquery'
  export default {
    data() {
      return {
        pricing: [{
          name: 'price1',
          expand: false,
          items: [{
            id: 1,
            price1: "10 online lessons",
            price2: "Interactive assignments",
            // Additional price details go here
          }]
        }]
      }
    ]
  },
  methods: {
    navItemCollapse(index) {
      this.pricing = this.pricing.map((item, i) => {
        item.expand = !item.expand;
        if (i !== index) {
          item.expand = false;
        }
        return item;
      });
    },
    navItemCollapse2(index) {
      // Method for collapsing second set of cards
    },
    navItemCollapse3(index) {
      // Method for collapsing third set of cards
    }
  }
</script>

Answer №1

Experiment with altering the

:data-target="'#collapseOne'+i"
and replacing other :data-targets with :

:data-target="`#collapseOne+${i}`"

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

Assistance needed with implementing jQuery tabs

I'm looking to add a link that takes me directly to content within a non-default tab on another page. Here's the code snippet that explains what I need: My Code: This is from my profile_edit.php page: The javascript: <script src="Javascrip ...

Incorporating a remote PHP file into your website using JavaScript

Is it feasible to utilize JS (jQuery) for executing a $.post from any website on any domain to a script on my server? This query stems from my reluctance to disclose my PHP files to clients (and avoid spending money on ionCube or similar solutions). By se ...

Having trouble configuring webpack for CSS Modules? You may be dealing with an invalid configuration object

Encountering an issue while setting up webpack for CSS Modules... An error message is appearing stating that the configuration object is invalid. It seems that the output path specified as "build" is not an absolute path, which is required. Below are ext ...

Securing chat messages with AES encryption using Websockets, Crypto.js, and .NET

Recently, I have implemented a user chat system using Websockets and ASP.MVC on the server. My goal was to ensure all messages sent and received through Websockets are encrypted (using AES). To achieve this, I decided to encrypt user messages before sendi ...

The footer should always be anchored at the bottom of the webpage, maintaining a consistent position regardless of any changes to the browser's

I've successfully implemented a footer with several buttons that remains positioned at the bottom of the page, 60px above the very bottom, regardless of the content or window size. The CSS I'm using is as follows: #container { min-height: 10 ...

What is the best method to retrieve the following element in jQuery?

My goal with jQuery is to create a functionality where clicking a button will clone the next element each time, creating a sequential pattern of cloning. For example, when I click the button for the first time it should clone "2", then if clicked again it ...

Manipulate SVG using Javascript

Is there a way to edit an SVG file directly in JavaScript without relying on any framework? I have a master SVG file that contains some child SVG elements. I've managed to retrieve the content of these children using Ajax, but now I need to insert t ...

Trigger an animation function with JQuery once the first one has finished

I am attempting to create a step-by-step animation of a div in JQuery. Each animation is triggered by a click, followed by a double-click, and so on. My issue arises when the animations overlap. When I double-click the div, both the first and second anima ...

AngularJS ng-hide in UI Bootstrap Alert causing unnecessary space occupation

Utilizing a simple UI Bootstrap alert to display error messages and more, I keep it hidden below a header at the top of my page by default. By using scope variables, I can customize the color and text and utilize ng-hide for hiding. Here's the alert H ...

Firefox not clearing Highcharts points properly

I am currently utilizing highcharts to generate dynamic charts when hovering over a table row. My goal is to clear and hide the chart once the mouse moves away from the row. While this functionality works smoothly in Chrome, I am encountering a strange is ...

Instructions on invoking the validate function of an Element-UI form

In my current Vue.js project, I am working on designing forms using Element-UI. One of the requirements is to ensure that the form is valid before proceeding with any further actions once the submit button is clicked. I am seeking guidance on how to acces ...

Wait for Axios Request Interceptor to complete before sending another ajax call

One feature I have added is a request interceptor for all axios calls. This interceptor checks the JWT token and automatically refreshes it if necessary. axios.interceptors.request.use((config) =>{ const currentState = store.getState(); // get upd ...

Adjust the speed of various CSS3 transitions on a container and its elements

Looking to incorporate Slidejs into my website? Check out the library. I want to set different transition speeds for elements on my page. Here's how my Html structure looks like: <div id="slides" class="sliders_1"> <div style="backgroun ...

Effortlessly generate various socket.io events within a node.js environment

Seeking advice on optimizing and following the DRY principle. My node server is functioning correctly, but I want to streamline the code for future developers. Currently, I have a series of events being set up in this manner: var debug = true; io.sock ...

Display the div if the ng-show directive in Angular shows an empty result

I am trying to display data using an Angular expression, but I also want to show a different message if the expression returns no data. However, my current approach is not working as expected. Can someone help me correct it? <span class="detail"&g ...

Angular: Card disabled post-click

I am displaying three cards <div *ngFor="let catalog of catalogs;let i=index" (click)="goToProducts(catalog)"> <div> <div class="name-position text {{catalog.classe}}" style="font-size: 21px;"> ...

top margin is functioning properly in Internet Explorer, but not in Google Chrome

margin-top is behaving differently in IE compared to Google Chrome. Two menus are supposed to be displayed one above the other in my design. The issue lies in the line margin-top:30%; within .anothermenu ul. In Chrome, the second menu appears above the f ...

Animating elements with CSS keyframes for scaling and translating transformations

I'm having trouble manipulating the size and position of an absolutely positioned div. Even after scaling, the div doesn't end up where I intended it to be in my keyframe animation. I suspect that this issue is caused by the fixed coordinates of ...

It can be rather time-consuming for updates to appear on a custom domain when using Firebase Hosting

I am currently using Vue Js app with the latest versions of Vite and Vue Router. After pushing changes to Firebase Hosting, I noticed that the changes are instantly reflected on the Firebase-provided domain (e.g mycompany.web.app), but it takes several da ...

When importing a module, the function in the ts file may not be recognized or located

While attempting to create a VSTS (Azure Devops) Extension, I encountered a perplexing issue. Within my HTML page, I have a button element with an onclick listener: <!DOCTYPE html> <head> <script type="text/javascript"> VS ...