vue if判断和三目运算符

vue if判断,根据内容进行显示

<template v-slot="scope">
                  <span :class="{'success-status':scope.row.level == 1 }" v-if="scope.row.level == 1">1星</span>
                  <span :class="{'error-status':scope.row.level == 5}" v-else-if="scope.row.level == 5">5星</span>
                  <span :class="{'warning-status':scope.row.level == 3}" v-else-if="scope.row.level == 3">3星</span>
</template>

vue 三目运算符

<template v-slot="scope">
                  <div :class="{'success-dot':scope.row.flag == false, 'error-dot':scope.row.flag == true }"></div>
                  <span :class="{'success-status':scope.row.flag == false , 'error-status':scope.row.flag == true}"> {{scope.row.flag == false ? "否" : "是"}} </span>
</template>
posted on 2022-08-29 16:42  每天进步一点点点点点  阅读(256)  评论(0)    收藏  举报