前端页面el-table里的数字转中文

使用formatter属性,在el-table-column标签中加入此属性

 <el-table-column
              :key="Math.random()"
              prop="tradeType"
              label="退费方式"
              align="center"
              :formatter="formatteTradeTyper"
              show-overflow-tooltip
              width="140"
            />

this.refundProcessingType是字典表返回的key和value,row.tradeType是列表中的行数据,判断列表中的数据,与字典表中的key做比较,相同则返回value

formatteTradeTyper(row, column) {
      var tradeTypeList = this.refundProcessingType
      for (var i = 0; i < tradeTypeList.length; i++) {
        if (row.tradeType === tradeTypeList[i].key) {
          return tradeTypeList[i].value
        }
      }
    },

 

posted @ 2022-11-03 10:20  joyfulest  阅读(444)  评论(0)    收藏  举报