Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Esvalirion committed Jan 19, 2021
1 parent bc89502 commit 39743de
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/qComponents/QTable/src/QTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@
v-if="$scopedSlots.header"
name="header"
:data="column"
v-bind="updateItem(column, index, column.key)"
v-bind="updateColumnItem(column, index, column.key)"
/>

<slot
v-else-if="column.slots && column.slots.header"
:name="column.slots.header"
:data="column"
v-bind="updateItem(column, index, column.key)"
v-bind="updateColumnItem(column, index, column.key)"
/>

<template v-else>
Expand Down Expand Up @@ -188,14 +188,14 @@
v-if="$scopedSlots.total"
name="total"
:data="total"
v-bind="updateItem(total, index, column.key)"
v-bind="updateTotalItem(total, index, column.key)"
/>

<slot
v-else-if="column.slots && column.slots.total"
:name="column.slots.total"
:data="total"
v-bind="updateItem(total, index, column.key)"
v-bind="updateTotalItem(total, index, column.key)"
/>

<template v-else-if="total[column.key]">
Expand Down Expand Up @@ -864,13 +864,19 @@ export default {
};
},
updateItem(item, index, key) {
const value = item.value ?? item[key] ?? null;
updateColumnItem(item, index, key) {
return {
columnKey: key || null,
index,
value: item.value ?? null
};
},
updateTotalItem(item, index, key) {
return {
columnKey: key || null,
index,
value
value: item[key] ?? null
};
},
Expand Down

0 comments on commit 39743de

Please sign in to comment.