feat: add `replace` prop to `Form` component (#1923)

This commit is contained in:
koopa 2023-10-24 20:24:23 +02:00 committed by GitHub
parent e2f6780de4
commit a7330d61b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -59,6 +59,9 @@ pub fn Form<A>(
/// Sets whether the page should be scrolled to the top when the form is submitted.
#[prop(optional)]
noscroll: bool,
/// Sets whether the page should replace the current location in the history when the form is submitted.
#[prop(optional)]
replace: bool,
/// Arbitrary attributes to add to the `<form>`. Attributes can be added with the
/// `attr:` syntax in the `view` macro.
#[prop(attrs)]
@ -83,6 +86,7 @@ where
children: Children,
node_ref: Option<NodeRef<html::Form>>,
noscroll: bool,
replace: bool,
attributes: Vec<(&'static str, Attribute)>,
) -> HtmlElement<html::Form> {
let action_version = version;
@ -94,6 +98,7 @@ where
let navigate = has_router.then(use_navigate);
let navigate_options = NavigateOptions {
scroll: !noscroll,
replace,
..Default::default()
};
@ -333,6 +338,7 @@ where
children,
node_ref,
noscroll,
replace,
attributes,
)
}