我需要根据评论等级来降低颜色。我希望像这样在Vue.js中完成一些工作:
<div class="review" :style="reviewColor(hotel.average)">
Run Code Online (Sandbox Code Playgroud)
在我的方法中,我有这样的东西:
reviewColor() {
return 'green';
}
Run Code Online (Sandbox Code Playgroud)
不幸的是,这没有给我提供'green'课程。我希望在该方法中进行颜色计算。
如果等级小于7,则必须是特定的颜色,如果介于7到8之间并且高于8。
I need these calculations in a clean matter. Is there any alternative?
I can't inline it because I have 2 elements that need to respond to a class.