相关疑难解决方法(0)

Vue.js动态类名?

我需要根据评论等级来降低颜色。我希望像这样在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.

javascript vue.js vuejs2

0
推荐指数
1
解决办法
1943
查看次数

标签 统计

javascript ×1

vue.js ×1

vuejs2 ×1