From 72c85b75d05c6f9cdb25ba8b086f15eb4743ab1e Mon Sep 17 00:00:00 2001 From: rizky Date: Tue, 20 Aug 2024 23:10:27 -0700 Subject: [PATCH] fix --- comps/form/field/FieldInput.tsx | 4 ++-- comps/popup/NavLink.tsx | 39 +++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/comps/form/field/FieldInput.tsx b/comps/form/field/FieldInput.tsx index 8c5bafe..481bdec 100755 --- a/comps/form/field/FieldInput.tsx +++ b/comps/form/field/FieldInput.tsx @@ -135,7 +135,7 @@ export const FieldInput: FC<{ {prefix && prefix !== "" ? (
& { - params?: { - name?: string; - where?: any; - create?: any; - update?: any; - breads?: { label: string; url?: string }[]; - }; - } -> = (props) => { +export const NavLink: FC<{ + className?: string; + href?: string; + children?: any; + back_title?: string; + params?: { + name?: string; + where?: any; + create?: any; + update?: any; + breads?: { label: string; url?: string }[]; + }; +}> = (props) => { const local = useLocal({ loading: false }); let href = props.href || ""; @@ -42,13 +44,26 @@ export const NavLink: FC< setTimeout(() => { local.loading = false; }, 3000); + } else if (props.back_title) { + local.loading = true; + local.render(); + navigate(props.href, { breads: [{ label: props.back_title }] }); + setTimeout(() => { + local.loading = false; + }, 3000); } else { navigate(props.href); } } }} > - {local.loading ? : props.children} + {local.loading ? ( +
+ +
+ ) : ( + props.children + )} ); };