<el-table-column label="用户角色" width="120" :formatter="formatFunc">
<template slot-scope="scope">
<span>{{ scope.row.role.roleName }}</span>
</template>
</el-table-column>
formatFunc一直不执行,后来经过排查发现是template中插槽作用域导致的,
<el-table-column prop="roleName" label="用户角色" width="120" :formatter="formatFunc">
</el-table-column>
像这样写就搞定了!
不过后来发现用vue自带的filter过滤器更加方便,可以全局统一管理,用起来那叫一个爽!