This can be achieved by using the slot function of the table component to pass data to the method.
You only need to define a conversion method to render it to the dom
<el-table-column label="交易类型" prop="use_type">
<template slot-scope="{row}">
{
{ transformNum(row.use_type) }}
</template>
</el-table-column>
transformNum method
If the return value is 3, it will be rendered as period payment...
transformNum(num){
switch (num) {
case 3:
return '账期支付'
case 4:
return '退款入账'
case 5:
return '账期还款'
}
},
el-table-column can directly nest router-link using slot-scope
<el-table>
<el-table-column label="订单" width="240">
<router-link
v-if="scope.row.order.order_sn"
tag="span"
:to="`${scope.row.order_id}`"
class="id"
slot-scope="scope"
>{
{scope.row.order}}</router-link>
<span v-else>无</span>
</el-table-column>
</el-table>
It can also be achieved by using js object key-value pairs to define an object in the database.
<view class="line line_3">
<view class="left">交易类型:<text>{
{propObj[item.use_type]}}</text></view>
</view>
propObj: {
3: '账期支付',
4: '退款入账',
5: '账期还款'
}
ps: Beginners record it!