Эх сурвалжийг харах

Table: add value as formatter parameter (#5709)

* 添加接口计算原来的列值

* export old value of column in formatter function

* Update table-column.js

* Update table-column.js
helondeng 8 жил өмнө
parent
commit
92d6008802

+ 5 - 7
packages/table/src/table-column.js

@@ -97,15 +97,13 @@ const getDefaultColumn = function(type, options) {
 
 const DEFAULT_RENDER_CELL = function(h, { row, column }) {
   const property = column.property;
+  const value = property && property.indexOf('.') === -1
+    ? row[property]
+    : getValueByPath(row, property);
   if (column && column.formatter) {
-    return column.formatter(row, column);
+    return column.formatter(row, column, value);
   }
-
-  if (property && property.indexOf('.') === -1) {
-    return row[property];
-  }
-
-  return getValueByPath(row, property);
+  return value;
 };
 
 export default {