Refactor on DataTable
parent
ff20a00e8f
commit
3ce0a109d2
|
@ -162,7 +162,7 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
columns: [],
|
allChildren: null,
|
||||||
d_first: this.first,
|
d_first: this.first,
|
||||||
d_rows: this.rows,
|
d_rows: this.rows,
|
||||||
d_sortField: this.sortField,
|
d_sortField: this.sortField,
|
||||||
|
@ -184,7 +184,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.columns = this.$children.filter(child => child.$options._propKeys.indexOf('columnKey') !== -1);
|
this.allChildren = this.$children;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getRowKey(rowData, index) {
|
getRowKey(rowData, index) {
|
||||||
|
@ -264,6 +264,12 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
columns() {
|
||||||
|
if (this.allChildren) {
|
||||||
|
return this.allChildren.filter(child => child.$options._propKeys.indexOf('columnKey') !== -1);
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
if (this.value && this.value.length) {
|
if (this.value && this.value.length) {
|
||||||
let data = this.value;
|
let data = this.value;
|
||||||
|
|
Loading…
Reference in New Issue