|
@@ -35,6 +35,7 @@ export default {
|
|
|
fields: { type: Array, required: true },
|
|
|
data: { type: Array, required: true },
|
|
|
opera: { type: Array, default: () => [] },
|
|
|
+ toFormat: null,
|
|
|
},
|
|
|
components: {},
|
|
|
data: () => ({}),
|
|
@@ -46,7 +47,15 @@ export default {
|
|
|
if (this_fields.length > 0) {
|
|
|
let format = _.get(this_fields[0], `format`, false);
|
|
|
if (format) {
|
|
|
- let res = format(cellValue);
|
|
|
+ let res;
|
|
|
+ if (_.isFunction(format)) {
|
|
|
+ res = format(cellValue);
|
|
|
+ } else {
|
|
|
+ res = this.toFormat({
|
|
|
+ model: this_fields[0].prop,
|
|
|
+ value: cellValue,
|
|
|
+ });
|
|
|
+ }
|
|
|
return res;
|
|
|
} else return cellValue;
|
|
|
}
|