element中表格的使用
模板:
<el-table-column label="支付方式" width="100" align="center">
<template slot-scope="scope">
{{scope.row.payType | payType}}
</template>
</el-table-column>
遇到這種表格的渲染,支付方式,後臺返回的是1~4這四個狀態
1:表示微信 2:銀行卡 3: 4:。。。
當遇到這種沒辦法使用三元表達式渲染的時候用過濾器(filters 和 data 以及methods 同等級)
filters:{
payType (num) {
if (num == 1) {
return "微信支付"
} else if (num == 2) {
return "銀行卡"
} else if (num == 3) {
return "快捷支付"
} else if(num == 4) {
return "餘額支付"
}
}
}