数据库中存储颜色值,我想在Vue页面不展示这个字段值,而是根据字段值,让 它显示对应颜色块
有什么办法呢
可以尝试把这一列的代码改为
<el-table-column prop="字段名" label="标题颜色" width="auto">
<template slot-scope="scope">
<div :style="{ 'width': '30px', 'height': '30px', 'background-color': scope.row.字段名 }"></div>
</template>
</el-table-column>
color设置为你数据库的值不就好了么