当前位置: 代码迷 >> 综合 >> elementUI中的表格怎么根据请求回的数据自定义内容(比如:状态、性别)
  详细解决方案

elementUI中的表格怎么根据请求回的数据自定义内容(比如:状态、性别)

热度:15   发布时间:2024-02-28 00:34:06.0

加一个slot-scope

const map = {'0': '全部','1': '正常','2': '待发布','3': '已删除',
}
<el-table-columnprop="status"label="状态"align="center"width="100"><template slot-scope="scope"><span>{
   { map[scope.row.status] }}</span></template>
</el-table-column>

 

 

element中table列数据的格式化(判断男女,是否等) formatter用法

 

 <el-table-columnprop="sex"label="性别":formatter="formatter"></el-table-column>
 methods:{formatter(row, column) {return row.TableIsbibei === 1? "男" : "女";},}

 

  相关解决方案