<h2 :class="text | timerTextColor">类选择器</h2>
<h2 :style="text | textColor">内联</h2>
data() {
return {
text:1
};
},
filters: {
timerTextColor(v){
if (v >= 0) {
return 'countDownColor'
} else {
return 'TimeoutColor'
}
},
textColor(v){
if (v >= 0) {
return 'color:blue'
} else {
return 'color:red'
}
}
},
.countDownColor{
color: blue;
}
.TimeoutColor{
font-size:20px;
color: red;
}