vue中filters的用法
一、代码
<el-table-column prop="taskStatus" label="处理状态" align="left">
<template slot-scope="scope">
//scope.row.taskStatus为1,2,3
{{ scope.row.taskStatus | typeFilter }}
</template>
</el-table-column>
filters: {
typeFilter(val) {
let typeData = {
1: '生成中',
2: '生成成功',
3: '生成失败',
}
return typeData[val]
},
},