mirror of
https://github.com/Art051/it-tools.git
synced 2025-08-11 19:29:03 +00:00
refactor(date-converter): improved ux and layout
This commit is contained in:
committed by
Corentin THOMASSET
parent
5fa811a583
commit
fd9ab59172
@@ -25,7 +25,15 @@ export type ValidationAttrs = {
|
||||
validationStatus: string | undefined;
|
||||
};
|
||||
|
||||
export function useValidation<T>({ source, rules }: { source: Ref<T>; rules: UseValidationRule<T>[] }) {
|
||||
export function useValidation<T>({
|
||||
source,
|
||||
rules,
|
||||
watch: watchRefs = [],
|
||||
}: {
|
||||
source: Ref<T>;
|
||||
rules: UseValidationRule<T>[];
|
||||
watch?: Ref<unknown>[];
|
||||
}) {
|
||||
const state = reactive<{
|
||||
message: string;
|
||||
status: undefined | 'error';
|
||||
@@ -42,7 +50,7 @@ export function useValidation<T>({ source, rules }: { source: Ref<T>; rules: Use
|
||||
});
|
||||
|
||||
watch(
|
||||
[source],
|
||||
[source, ...watchRefs],
|
||||
() => {
|
||||
state.message = '';
|
||||
state.status = undefined;
|
||||
|
||||
Reference in New Issue
Block a user