
1. 在 el-table-column 上绑定了 formatter 方法 formatEntityName ,它会对每一行该列的数据( cellValue )进行处理。
-
在 formatEntityName 方法中,尝试对传入的 cellValue 进行 JSON.parse 操作,并根据解析结果返回合适的值。
-
在 <template> 的作用域插槽中,通过 scope.formattedValue 来获取 formatter 处理后的值(这是 el-table 中 formatter 处理后会自动添加到 scope 上的属性 ),然后直接在 <span> 中展示。