vue element表格列内容格式化

<el-table-column
  prop="targetValueType"
  label="目标选项"
  :formatter="formatTargetValueType"
  :show-overflow-tooltip="true"
  width="120"
>
  <!--<el-badge class="item">数据查询</el-badge>-->
  <!--:formatter="formatTargetValueType"-->
  <!--<template slot-scope="scope">-->
  <!--<el-span v-if="scope.row.targetType === '0'">必达<i class="el-icon-warning" style="color: red"></i></el-span>-->
  <!--<el-span v-else-if="scope.row.targetType === '1'">挑战</el-span>-->
  <!--<el-span v-else-if="scope.row.targetType === '2'">极限</el-span>-->
  <!--</template>-->
</el-table-column>

1.这个只是文本格式化

 :formatter="formatTargetValueType" 

2.中间注释的部分既可以格式化文本,也可以样式或者其他标签

猜你喜欢

转载自blog.csdn.net/wxzxmq/article/details/106815760
今日推荐