Tips for properly displaying a list of items using v-for

Seeking assistance on this issue. Link: https://codepen.io/iTaurus85/pen/aRNWd. I am facing difficulty in displaying PriceItems.text.content within v-list-tile-title using v-for loop. My goal is to display something like: Testing plan: Full access, -, -, -. Basic plan: Full access, Support, Chat, - and so on based on PriceItems.text.

<div id="app">
  <v-app id="inspire">
   <v-flex xs4 v-for="item in PriceItems" :key="item.title" :class="item.class" >
     <h3 class="price__block-title">{{item.title}}</h3>
     <h5 class="price__block-subtitle">{{item.subTitle}}</h5>
     <v-list dense class="price__block-list">
       <v-list-tile class="price__block-item">
         <v-list-tile-content>
           <v-list-tile-title class="text-xs-center" >
             {{item.text.content}}
           </v-list-tile-title>
         </v-list-tile-content>
       </v-list-tile>
       <v-divider></v-divider>
     </v-list>
   </v-flex>
  </v-app>
</div>

.price__block{
  display: flex;
  align-items: center;
  flex-direction: column;
  background-color: #00a1c7;
  margin: 5px;
}

.v-list.price__block-list {
  background: transparent;
}

new Vue({
  el: '#app',
  data: function() {
    return {
       PriceItems: [
      {class:'price__block price__block-testing',title:'Testing',subTitle:'1 day',
      text:[
        {content:'Full access'},
        {content:' - '},
        {content:' - '},
        {content:' - '}
        ]},
      {class:'price__block price__block-testing',title:'Basic',subTitle:'7 days', 
       text:[
        {content:'Full access'},
        {content:'Support'},
        {content:'Chat'},
        {content:'-'}
        ]},
      {class:'price__block price__block-testing',title:'Standart',subTitle:'30 days', 
       text:[
        {content:'Full access'},
        {content:'Support'},
        {content:'Chat'},
        {content:'Call'}
        ]},
      {class:'price__block price__block-testing',title:'Premium',subTitle:'120 days', 
       text:[
        {content:'Full access'},
        {content:'Support'},
        {content:'Call'},
        {content:'Chat'}
        ]},
    ]

    }
  }
})

Answer №1

If your child content is in an array format, make sure to use an iterator just like you did for the priceitems with v-for="item in PriceItems"

 <v-list-tile-title class="text-xs-center" v-for="itemContent in item.text">
     {{itemContent.content}}
  </v-list-tile-title>

Check out the demo here

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

Tips for retaining the value of a variable in JavaScript

I am a page that continuously redirects to itself, featuring next day and previous day arrows. Upon loading, the page always displays the new day. The days are stored in a localStorage as follows: for(var i = 0; i < status.length; i++) { local ...

Verify information and send messages using JavaScript validation

I need assistance with my HTML form and JavaScript code. I am trying to send a parameter from the form to JavaScript in order to check if the input matches any values in an array. If there is a match, I want an alert message to be sent. However, the issue ...

Is there a way for me to access and retrieve the content of a tinymce textarea that has been modified

After clicking the 'Edit HTML Below then Click Display' button, my input texts work perfectly fine. However, I am facing issues with my tinymce textareas as they do not send the new value to the iframe when edited. How can I resolve this problem ...

Combining arrays using JavaScript

I'm struggling to enhance the following code - it looks a bit messy: Here is my data format: date d1 d2 d3 d4 d5 d6 110522 5 1 3 5 0 7 110523 9 2 4 6 5 9 110524 0 0 0 0 1 0 110525 0 0 3 0 4 0 ... I am importing data from a text file using d3.j ...

Utilizing Three.js to apply a matrix transformation to a collection of objects and subsequently refreshing their positions

How can we ensure that objects added to a group in a scene (now Object3D()) correctly apply the group's matrix, updating their locations within the scene? ...

Selecting items from a list at random using the power of math.random() and math.floor()

When attempting to randomize the popping of elements in a list stored in the baby variable, only baby[1] is being popped. How can I make it pop random elements? <body> <h1 id="1">bebe</h1> <h1 id="2">t ...

Deactivating attribute inheritance / configuring component settings with script setup and Typescript

Is there a way to disable attribute inheritance for a component's options when using script setup syntax with Typescript in Vue 3? Here is the JavaScript code example: app.component('date-picker', { inheritAttrs: false, // [..] }) How ...

Facing an issue where the data returned in React is showing up as undefined

I am currently facing an issue with passing data down to a component using react router. After confirming that the endpoint is functioning correctly, I have ruled out any server-related problems. Here is the function responsible for fetching page data bas ...

Library for Nodejs that specializes in generating and converting PDF/A files

Is there a library available that can convert/create a PDF/A file? I've been searching for solutions but the existing answers suggest using an external service or provide no response at all. I heard about libraries in other languages like ghostscriptP ...

Unable to locate three.js library

Hey there, I'm currently working on creating the "get started" application from the three.js website. For reference, you can check out their guide at . Here's a snippet of the HTML code I've put together: <!DOCTYPE html> <html lan ...

What is the rationale behind using `./routes` instead of just `/routes` in express routes?

In most instances that I've come across, the app.js file typically uses the require function with the path of ./. I'm curious as to why we can't simply use /. For example, why wouldn't the following code work: var express = require(&ap ...

What could be causing this error in my JavaScript loop that it says "missing 'of' after 'for'?

dataPoints: [ for(i = 0;i<json.data.length;i++){ { label: json.data[i][1], y: parseInt(json.data[i][2])} }] I encountered an issue with the code above and observed an error in the console. The SyntaxError message states: "missing 'of ...

Identifying the completion of file uploads in jQuery File Upload

I am currently utilizing the jQuery File Upload plugin for my project. One thing I am looking to achieve is triggering an event once all selected files have completed uploading. I already have events in place for when file(s) are chosen for upload and whe ...

ReactJS - What makes ReactJS unique compared to other technologies?

Hey there! I'm currently trying to figure out why this specific code snippet was successful while my previous one wasn't. I've included both snippets below: SUCCESSFUL CODE: handleInputChange = (e) => { let { value } = e.target; ...

Removing a particular item from an Observable of arrays containing any type

My application has an Observable that contains an array of places: places: Observable<Array<any>>; In the template, I am using the async pipe to iterate over the array: <tr *ngFor="let place of places | async"> ... </tr> After ...

In Loopback, I have defined two remote methods within a single model, yet only one is accessible through the API explorer

I'm facing a challenge with making 2 remote methods function in the same loopback model. Only one is operational in the api explorer at a time - when I comment out or delete the code for one, the other works seamlessly. Here's my approach: modul ...

Console.log is displaying array as [object Object] when utilizing Typescript

When working with an object in typescript called "obj," I encountered a strange behavior. Initially, when I ran the console.log(obj); command, the output in the terminal console was displayed as [object Object]. However, after wrapping it in JSON.stringify ...

Vue.js is limited in its ability to efficiently partition code into easily loadable modules

My current issue: I am facing a challenge with splitting my vue.js code into chunks. Despite trying multiple examples from tutorials, I am unable to successfully separate the components and load them only when necessary. Whenever I attempt to divide the c ...

Rotating an SVG shape a full 360 degrees results in no visible change

Currently, I am utilizing d3.js for a project and encountering an issue with rotating an SVG element 360 degrees to achieve a full spin back to its original position. If I rotate the element 3/4 of the way using the following code snippet, it works effect ...

How to dismiss a jQueryMobile dialog without triggering a page refresh

I've encountered a question similar to this before, but there wasn't any solution provided. The issue I'm facing is that I have a form and when a user clicks on a checkbox, I want to open a popup/dialog for them to enter some data. However, ...