element-UI 根据table中数据改变颜色 或显示对应内容

element-UI 根据table中数据改变颜色 或显示对应内容

1、根据table中数据的值改变显示颜色,效果:


代码:

<el-table-column prop="countdown" label="剩余天数(天)" width="95">
	<template scope="scope">
              <span v-if="scope.row.countdown>=6" style="color:#000000">{{ scope.row.countdown }}</span>
              <span v-else style="color: red">{{ scope.row.countdown }}</span>
        </template>
</el-table-column>
2、根据table中数据的值显示对应内容,

代码:

<el-table-column prop="grade" label="等级" width="80">
	<template slot-scope="scope">
		<span v-if="scope.row.grade=='0'">特级</span>
		<span v-if="scope.row.grade=='1'">一级</span>
		<span v-if="scope.row.grade=='2'">二级</span>
	</template>
</el-table-column>


猜你喜欢

转载自blog.csdn.net/adonis_d_gogh/article/details/80001307