refactor(date-converter): improved ux and layout
This commit is contained in:
1 parent
5fa811a583
commit
fd9ab59172
7 files changed
+346
-76
No files matched your search
@@ -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