update list view

This commit is contained in:
Marco Crapts
2023-05-19 11:00:18 +02:00
parent d45045d63f
commit 0619707054

View File

@@ -1,13 +1,42 @@
<script setup lang="ts">
const rows = [
{
noteTitle: 'Cy Ganderton',
references: 'Quality Control Specialist',
modified: 'Blue',
},
{
noteTitle: 'Hart Hagerty',
references: 'Desktop Support Technician',
modified: 'Purple',
},
{
noteTitle: 'Brice Swyre',
references: 'Tax Accountant',
modified: 'Red',
},
].map((row) => ({
...row,
selected: false,
}))
const checkedRows = ref<{ [key: string]: Boolean }>({})
const toggleRow = (rowId: string) =>
(checkedRows.value[rowId] = !checkedRows.value[rowId])
</script>
<template> <template>
<div class="overflow-x-auto"> <div class="overflow-x-auto">
<table class="table-compact table w-full"> <table class="table-compact table w-full">
<!-- head -->
<thead> <thead>
<tr> <tr>
<th> <th>
<label> <!-- <label>
<input type="checkbox" class="checkbox-primary checkbox checkbox-sm" /> <input
</label> type="checkbox"
class="checkbox-primary checkbox checkbox-sm border-secondary"
/>
</label> -->
</th> </th>
<th>Note title</th> <th>Note title</th>
<th>References</th> <th>References</th>
@@ -15,38 +44,23 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<!-- row 1 --> <tr
<tr class="hover"> class="hover hover:cursor-pointer"
v-for="row in rows"
@click="toggleRow(row.noteTitle)"
>
<th> <th>
<label> <label>
<input type="checkbox" class="checkbox-primary checkbox checkbox-sm" /> <input
type="checkbox"
class="checkbox-primary checkbox checkbox-sm border-secondary"
v-model="checkedRows[row.noteTitle]"
/>
</label> </label>
</th> </th>
<td>Cy Ganderton</td> <td>{{ row.noteTitle }}</td>
<td>Quality Control Specialist</td> <td>{{ row.references }}</td>
<td>Blue</td> <td>{{ row.modified }}</td>
</tr>
<!-- row 2 -->
<tr class="hover">
<th>
<label>
<input type="checkbox" class="checkbox-primary checkbox checkbox-sm" />
</label>
</th>
<td>Hart Hagerty</td>
<td>Desktop Support Technician</td>
<td>Purple</td>
</tr>
<!-- row 3 -->
<tr class="hover">
<th>
<label>
<input type="checkbox" class="checkbox-primary checkbox checkbox-sm" />
</label>
</th>
<td>Brice Swyre</td>
<td>Tax Accountant</td>
<td>Red</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>