use slot in table too
This commit is contained in:
parent
52dcab03ba
commit
6290eee156
3 changed files with 18 additions and 20 deletions
|
@ -24,16 +24,14 @@
|
|||
>
|
||||
</div>
|
||||
</th>
|
||||
<th>actions</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="item in internalItems" :key="item[keyName]" @click="$emit('itemActivated', item)">
|
||||
<td v-for="(column, index) in columns" :key="index">{{ item[column] }}</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-outline-secondary" v-for="(action, a_index) in actions" :key="a_index" @click.stop="action.fun&&action.fun(item)" >{{action.name}}</button>
|
||||
</div>
|
||||
<slot v-bind:item="item"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
@ -4,14 +4,15 @@
|
|||
<div class="col-xl-8 offset-xl-2">
|
||||
<Table
|
||||
:columns="['cid', 'name']"
|
||||
:actions="[
|
||||
{name:'enlarge'},
|
||||
{name:'content', fun: item => showBoxContent(item.name)},
|
||||
{name:'delete'},
|
||||
]"
|
||||
:items="loadedBoxes"
|
||||
:keyName="'cid'"
|
||||
/>
|
||||
v-slot="{ item }"
|
||||
>
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-outline-secondary" @click.stop="showBoxContent(item.name)" >content</button>
|
||||
<button class="btn btn-outline-secondary" @click.stop="" >delete</button>
|
||||
</div>
|
||||
</Table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -17,22 +17,21 @@
|
|||
<div class="col-xl-8 offset-xl-2">
|
||||
<Table
|
||||
:columns="['uid', 'description', 'box']"
|
||||
:actions="[
|
||||
{name: 'enlarge', fun: item => openEditingModalWith(item)},
|
||||
{name: 'delete',fun: item => deleteItem(item)}
|
||||
]"
|
||||
:items="loadedItems"
|
||||
:keyName="'uid'"
|
||||
v-slot="{ item }"
|
||||
@itemActivated="openLightboxModalWith($event)"
|
||||
/>
|
||||
>
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-outline-secondary" @click.stop="openEditingModalWith(item)" >edit</button>
|
||||
<button class="btn btn-outline-secondary" @click.stop="deleteItem(item)" >delete</button>
|
||||
</div>
|
||||
</Table>
|
||||
</div>
|
||||
</div>
|
||||
<Cards
|
||||
v-if="layout === 'cards'"
|
||||
:columns="['uid', 'description', 'box']"
|
||||
:actions="[
|
||||
{name: 'delete'}
|
||||
]"
|
||||
:items="loadedItems"
|
||||
:keyName="'uid'"
|
||||
v-slot="{ item }"
|
||||
|
@ -48,10 +47,10 @@
|
|||
<div class="row mx-auto mt-2">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-outline-secondary" @click.stop="openEditingModalWith(item)">
|
||||
Edit
|
||||
edit
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary" @click.stop="deleteItem(item)">
|
||||
Delete
|
||||
delete
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue