Files
OCS_service/app/components/ui/table/utils.ts
T
2026-05-22 15:02:31 +08:00

11 lines
304 B
TypeScript

import type { Updater } from '@tanstack/vue-table'
import type { Ref } from 'vue'
import { isFunction } from '@tanstack/vue-table'
export function valueUpdater<T>(updaterOrValue: Updater<T>, ref: Ref<T>) {
ref.value = isFunction(updaterOrValue)
? updaterOrValue(ref.value)
: updaterOrValue
}