vue table 列判断 ,用于 状态类 动态显示;

  <el-table-column  label="净化器状态" min-width="70" align="center" sortable header-align="center">
<template slot-scope="scope">
   <div v-if="scope.row.sourceState == 1"
       class="inline-block bg-green width20 height20 border-radius10"></div>
   <div v-if="scope.row.sourceState == 2"
       class="inline-block bg-grey width20 height20 border-radius10"></div>
   <div v-if="scope.row.sourceState == 3"
       class="inline-block bg-grey width20 height20 border-radius10"></div>
   <div v-if="scope.row.sourceState == 4"
       class="inline-block bg-yellow width20 height20 border-radius10"></div>
</template>
   </el-table-column>

重点是  template slot-scope="scope" ,下边的 if;

Logo

前往低代码交流专区

更多推荐