Questions tagged [v-for]

Vue.js contains a powerful directive called V-for that facilitates the iteration of elements in an array or object.

Is there a way to properly assign an index to a multidimensional array in a Vue.js template?

My setup involves utilizing Vue along with a multidimensional array structured like this: myArray = [[1,2,3],[1,2,3],[1,2,3]] To achieve the desired HTML layout shown below (ensuring that data-item counter increments correctly): <div class="row" data ...

accessing elements in a loop in vuejs

I am trying to create a rating system using Vue.js and the v-for directive. Here is the code I have: <div class="rating-container"> <input type="radio" name="star" value="5" id="star-5"> <label class="star-radio" for="star-5">5&l ...

Looping through an array of nested objects using Vue

I have encountered a challenge with accessing specific data within an array that I am iterating over. The array is structured as follows, using Vue.js: companies: [ name: "company1" id: 1 type: "finance" additionalData: "{& ...

Using v-select to connect a Rest API with v-data-table was not displaying correctly, so I had to resort to using v-for to populate the table instead

Purpose: 1.Rest API >>> by axios 2.Select category >>> by v-select 3.Show table >>> by v-data-table however, there is an issue with displaying the table so I am using v-for to show it instead. View what I have managed to displa ...

how to change the color of a specific item in a list created using v-for

I'm a beginner when it comes to vueJs and I'm attempting to toggle the class "active" on a single element once it has been clicked. Currently, my code toggles all elements with the class material_icons. How can I modify it to toggle only the elem ...

How many times can vue.js v-for iterate through a variable?

Looking to loop through rows in a table using a range? Most examples show how to do this for a fixed value, like: <div> <span v-for="n in 10">{{ n }} </span> </di But what if you want to achieve this with a variable like below? &l ...

Using Vue's v-for directive: Populate HTML dynamically with an event handler (@change) from an array within a component template

This is the setup I am currently using: HTML <question v-for="question in questions" v-bind:id="question.id" v-bind:title="question.title" v-bind:statement="question.statement" v-bind:interaction="question.interaction" @onchange-vg=" ...

Render multiple checkboxes with values from an array of objects passed as a prop to a child component using a v

I am facing an issue with my Vue components 'Parent' and 'Child'. Each child component has a checkbox with a :checked prop. In the Parent component, I iterate through an array of objects and pass props to the child. Although I can emit an event from the ch ...

Exploring the dynamic data loading feature in Vue 3 by fetching data from the server and displaying it using a v-for

I am encountering an issue where I want to display data dynamically from a database using a v-for loop. However, when I attempt to push new data into the array, they show correctly in a console.log() but do not reflect any changes in the template. I have ...

Tips for creating a dynamic component with v-for and utilizing dynamic slots

I am facing an issue with a child component that utilizes v-for. My goal is to allow the parent component to dictate how each item within the v-for loop is displayed by passing down a slot or similar mechanism. The challenge lies in the fact that the paren ...

Expanding Vue JS Vuetify Panels in a V-for Loop to Reveal Multiple Panels

When pulling data from a database and looping through it in the DOM using a "v-for" loop, I encountered an issue with Vuetify expansion panel components. The problem is that when a user clicks to open one expansion panel, it ends up opening all other panel ...

Enabling the value to be set as true for radio buttons generated using v-for

Utilizing a v-for loop over an array of objects in graphicState, the rows of a table are dynamically generated. My goal is to implement a column of radio buttons that, when checked, will set graphicState[index].selected to true. I came across this insight ...

What is the best method to retrieve the v-model values of v-for components when iterating with numeric indices?

Within my template, I have form-group components that are being iterated over based on the value of a select element (an integer). My goal is to access the values of these iterated v-models, but I am struggling to get it right. TEMPLATE <b-form-g ...

Display a date that is asynchronously rendered for each item in the v-for loop

I am currently working on a project that involves an array of servers being displayed in a template using v-for. To receive dynamic data for each server, I have implemented the vue-nats library to subscribe them individually. methods: { subscribe(uuid) ...

Is there a way to retrieve the value of the object when the key is stored in a separate variable within a v-for

One query I have is about accessing data stored in Vuex and using v-for to loop through a list of object keys. How can I retrieve the data using mapGetters within the v-for loop? I've attempted passing the key into curly braces in the v-for loop as sh ...

in vuejs, a legendary row is added to the table every 25 or 50 records

VueJS v-for is functioning properly: <tr v-for="request in requests"> <td>{{request.name}}</td> <td> .. etc .. </td> </tr> Now, I want to insert a legend row after every 25 or 50 records. Here's what I tri ...

V-For with a Twist: Dynamic V-Model

UPDATE Here is a recreation of the issue I am facing I need to dynamically bind with the correct index, how can I achieve this? CLICK THE CODEPEN LINK ABOVE FOR THE OLD CODE CLICK THE CODEPEN LINK ABOVE FOR THE OLD CODE <template> <div> ...

Simultaneous Vue components

Here's an example of a string: "Greetings Earthlings! I come in peace." Along with a set of words. ["Greetings", "Earthlings", "peace"] I want to automate the process of enclosing matching words within Vue components. For instance, it should look ...

I am struggling to see any results display when using the v-for directive in my Vue.js project

I've developed an application where users can leave comments on each other's profile pages, but I'm encountering issues with displaying these comments. Despite using v-for, the output on the screen shows {{ comment.from }} and {{ content.from }}, instead o ...

Link the index value of a v-for loop to the id of a newly created component

I need to create components in a loop within my Vue app, but I want each component to have a unique id value like "board-1" based on the index of the loop. Just like how I did it with v-bind:key="component-${block._uid}". How can I make this happen? < ...

Retrieve the value of the following object in a loop - Vue JS

I needed to verify whether a specific property of an object matches the property of the next object in an array of objects while looping through using a v-for loop. Here's an example JSON object: [ { Date: '21-July-2017', ...}, { Date: '21-July-2017' ...

Tips for preventing the need to re-render every child component generated by the v-for directive

Here is a paragraph about the list of child components: <question-list-item v-for="(item, index) in questionListParsed" :key="item.id" :both-question="item" :class-id="classId" ...

I'm having trouble showing data from an API in my Vue.js application using v-for

I am struggling to fetch and display data from an API in my Vue.js application. Although the API seems to be functioning correctly when I check using console.log(), I am unable to populate the table with the retrieved data. Since I am new to Vue.js, I am u ...

Unlocking the variables within a v-for loop post-mounted: A guide to accessing and updating them

I have a question regarding my code snippet below. The calculation of Ending Inventory involves adding the beginningInventory, newInventory, and totalSold values. How can I access the value property of endingInventory in order to update it? Any assistance ...

Troubleshooting Vue.js nested v-for with <tr> tag problem

Why does Vue complain about undefined properties when I try nesting a <tr> inside a <tr> with a v-for binding on each? <table> <thead></thead> <tbody> <tr v-for="item in items"> <td>{{ item.nam ...

Components in need of updating

I'm currently using a template to show a list of components: <template> <v-container id="container"> <RaceItem v-for="(item, index) in items" :key="item + index" /> (...) Whenever I update the " ...

Display only the relevant data in a v-for loop

I'm struggling with the code snippet below: <template> <div> <div v-for="title in titles"> <h1>{{ title }}</h1> <a @click="showSub">Click Here</a> <div v-if=" ...

Vue.js - computed property not rendering in repeated list

It seems like the issue lies in the timing rather than being related to asynchronous operations. I'm currently iterating through an object and displaying a list of items. One of the values requires calculation using a method. While the direct values on th ...

Error in Vue.js: When using v-for, it is not possible to read a property

I'm working on creating multiple FAQ boxes using a list of objects containing questions and answers. However, I keep encountering the error message "Cannot read property 'question' of undefined." What could be causing this issue? Here's a snippet of my cod ...

Repeated keys found within a component's v-for loop

Dealing with v-for Duplicate Keys Error Even though the list is returned successfully, there seems to be a problem when I update a user in the array by changing their role. An error about duplicate keys is triggered. The key is assigned using the user&apo ...

A technique for calculating the total quantity of each item individually while using v-for in VueJS

Struggling to code (complete newbie) using VueJS and facing a major roadblock. I have a list of orders and I need to sum the quantities of each item separately. The only way to access the items is through v-for. <tr> <td data-th="list"> < ...