现在要通过data里面的数组来判断什么时候,字体显示什么颜色
<template>
<div v-for="ml in monlist">
<div :class="[ml.classtype==3?'pink':'nol',ml.classtype==4?'green':'nol']"></div>
</div>
</template>
<script>
export default {
data(){
return{
monlist:[
{classtype:1},
{classtype:2},
{classtype:3},
{classtype:4}
]
}
}
}
</script>
<style>
.nol{color: #333333;}
.pink{color: #ED4287;}
.green{color: #0DC190;}
</style>
要是各位有更好的办法,欢迎留言!