mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
playground(table): add select event
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { h, resolveComponent } from 'vue'
|
import { h, resolveComponent } from 'vue'
|
||||||
import { upperFirst } from 'scule'
|
import { upperFirst } from 'scule'
|
||||||
import type { TableColumn } from '@nuxt/ui'
|
import type { TableColumn, TableRow } from '@nuxt/ui'
|
||||||
import { getPaginationRowModel } from '@tanstack/vue-table'
|
import { getPaginationRowModel } from '@tanstack/vue-table'
|
||||||
|
|
||||||
const UButton = resolveComponent('UButton')
|
const UButton = resolveComponent('UButton')
|
||||||
@@ -279,6 +279,10 @@ function randomize() {
|
|||||||
data.value = [...data.value].sort(() => Math.random() - 0.5)
|
data.value = [...data.value].sort(() => Math.random() - 0.5)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onSelect(row: TableRow<Payment>) {
|
||||||
|
console.log(row)
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
@@ -337,6 +341,7 @@ onMounted(() => {
|
|||||||
}"
|
}"
|
||||||
sticky
|
sticky
|
||||||
class="border border-(--ui-border-accented) rounded-(--ui-radius)"
|
class="border border-(--ui-border-accented) rounded-(--ui-radius)"
|
||||||
|
@select="onSelect"
|
||||||
>
|
>
|
||||||
<template #expanded="{ row }">
|
<template #expanded="{ row }">
|
||||||
<pre>{{ row.original }}</pre>
|
<pre>{{ row.original }}</pre>
|
||||||
|
|||||||
Reference in New Issue
Block a user