Vue.component('entity-table', { props: [ "data" ], methods: { component_headers: function(name) { const value = this.data.data[name][0]; let headers = []; for (key in value) { headers.push(key); } return headers; }, component_member: function(value) { if (Array.isArray(value)) { return "[...]"; } else if (typeof value === 'object') { return "{...}"; } else if (typeof value === 'number') { return value.toFixed(1); } else { return value; } }, type: function(value) { if (Array.isArray(value)) { return 'array'; } else if (typeof value === 'object') { return 'object'; } else if (typeof value === 'number') { return 'number'; } else if (typeof value === 'boolean') { return 'boolean'; } else if (typeof value === 'string') { return 'string'; } else { return ''; } }, value_css: function(value) { return "property-value-" + this.type(value); } }, template: `
Id | Name | {{ key }} | ||
---|---|---|---|---|
{{ member }} | ||||
{{ entity }} | {{ data.data.Name[i].value }} | {{ component_member(component[i][member]) }} |