Answer the question
In order to leave comments, you need to log in
vue.js. How to get CSS class name from Data property?
There is an array of data:
data (){
return {
notes:[
{
title: 'First Note',
descr: 'Description for first note',
date: new Date(Date.now()).toLocaleString(),
info: 'int'
},
{
title: 'Second Note',
descr: 'Description for fsecond note',
date: new Date(Date.now()).toLocaleString(),
info: 'exc'
},
{
title: 'Third Note',
descr: 'Description for third note',
date: new Date(Date.now()).toLocaleString(),
info: 'imp'
}
]
}
}
<template>
<div class="notes">
<div class="note" :class="{ full: !grid }" v-for="(note, index) in notes" :key="index">
<div class="note-header" :class="{ full: !grid }">
<p>{{ note.title }}</p>
<p style="cursor: pointer" @click="removeNote(index)">✕</p>
</div>
<div class="note-body">
<P>{{ note.descr }}</P>
<div class="note-info">
<span class="note-data">{{ note.date }}</span>
<span class={{ 'ТУТ должно быть название класса из note.info' }}></span>// Этому элементу необходимо присвоить CSS класс.
</div>
</div>
</div>
</div>
</template>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question