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 185370b
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 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,8 +864,18 @@ export default {
};
},
updateItem(item, index, key) {
const value = item.value ?? item[key] ?? null;
updateColumnItem(item, index, key) {
const value = item.value ?? null;
return {
columnKey: key || null,
index,
value
};
},
updateTotalItem(item, index, key) {
const value = item[key] ?? null;
return {
columnKey: key || null,
Expand Down

0 comments on commit 185370b

Please sign in to comment.