HelloWorld.vue
<template>
<div>
<div v-for="box in boxes" :key="box.id">
<BaseAccordian>
<template v-slot:title>{{ box.name }}</template>
<template v-slot:content>
<div
v-for="paint in paints"
:key="paint.id"
class="line"
:class="{
green: paint.status === 'ok',
red: paint.status === 'notok',
pink: paint.status === 'medium',
}"
>
<div>{{ paint.name }}</div>
// only status like ok,not, medium to be printed on line accordingly
</div>
</template>
</BaseAccordian>
</div>
</div>
</template>
<style scoped>
.content > .line > div {
--line-width: 2px;
--x-offset: 8px;
--x-width: 120px;
position: relative;
padding-bottom: var(--line-width);
}
.content > .line > div:before {
content: "";
display: block;
position: absolute;
bottom: 0;
left: var(--x-offset);
width: var(--x-width);
height: 100%;
border-left: var(--line-width) dashed currentColor;
border-bottom: var(--line-width) dashed currentColor;
}
.content > .line > div:after {
content: "";
display: block;
position: absolute;
bottom: calc(-1 * var(--line-width) * 1.75);
left: calc(var(--x-offset) + var(--x-width));
width: 0;
height: 0;
border: calc(var(--line-width) * 2.5) solid transparent;
border-right: 0;
border-left: calc(var(--line-width) * 5) solid currentColor;
}
.green {
color: green;
font-weight: bold;
}
.red {
color: red;
font-weight: bold;
}
.pink {
color: pink;
font-weight: bold;
}
</style>
How to set condition for array value inside v-for. I am not sure, weather it is correct way, I am thinking to use computed property for handling my logic like wise given in the code.
Basically i have 3 arrays. in each array i have values like "a,b,c,d,e,x,y,z". So based on those values in each array in the computed property i want to handle the logic and print the particular status on the arraow line.