style: format code

pull/1775/head
tanjinzhou 2020-07-01 18:24:38 +08:00
parent 5a4d5ff6a7
commit 6420443466
3 changed files with 3 additions and 11 deletions

View File

@ -1,15 +1,11 @@
export function formatDate(value, format) {
const isFunction = function(obj) {
return !!(obj && obj.constructor && obj.call && obj.apply);
};
if (!value) {
return '';
}
if (Array.isArray(format)) {
format = format[0];
}
if (isFunction(format)) {
if (typeof format === 'function') {
const result = format(value);
if (typeof result === 'string') {
return result;

View File

@ -157,7 +157,7 @@ export default {
sPagination: this.getDefaultPagination(this.$props),
pivot: undefined,
sComponents: createComponents(this.components),
filterDataCnt: 0
filterDataCnt: 0,
};
},
watch: {

View File

@ -92,10 +92,6 @@ export function isAllowedDate(value, disabledDate, disabledTime) {
}
export function formatDate(value, format) {
const isFunction = function(obj) {
return !!(obj && obj.constructor && obj.call && obj.apply);
};
if (!value) {
return '';
}
@ -104,7 +100,7 @@ export function formatDate(value, format) {
format = format[0];
}
if (isFunction(format)) {
if (typeof format === 'function') {
const result = format(value);
if (typeof result === 'string') {
return result;