Skip to content

Commit 51e05db

Browse files
committed
fix(customers): improve email input
1 parent 1b7e37f commit 51e05db

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/pages/customers.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { useTemplateRef, h, ref, watch, resolveComponent } from 'vue'
2+
import { useTemplateRef, h, ref, computed, watch, resolveComponent } from 'vue'
33
import { upperFirst } from 'scule'
44
import type { TableColumn } from '@nuxt/ui'
55
import { useFetch } from '@vueuse/core'
@@ -190,6 +190,15 @@ watch(() => statusFilter.value, (newVal) => {
190190
}
191191
})
192192
193+
const email = computed({
194+
get: (): string => {
195+
return (table.value?.tableApi?.getColumn('email')?.getFilterValue() as string) || ''
196+
},
197+
set: (value: string) => {
198+
table.value?.tableApi?.getColumn('email')?.setFilterValue(value || undefined)
199+
}
200+
})
201+
193202
const pagination = ref({
194203
pageIndex: 0,
195204
pageSize: 10
@@ -213,11 +222,10 @@ const pagination = ref({
213222
<template #body>
214223
<div class="flex flex-wrap items-center justify-between gap-1.5">
215224
<UInput
216-
:model-value="(table?.tableApi?.getColumn('email')?.getFilterValue() as string)"
225+
v-model="email"
217226
class="max-w-sm"
218227
icon="i-lucide-search"
219228
placeholder="Filter emails..."
220-
@update:model-value="table?.tableApi?.getColumn('email')?.setFilterValue($event)"
221229
/>
222230

223231
<div class="flex flex-wrap items-center gap-1.5">

0 commit comments

Comments
 (0)