mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
Simple NodeRef passing to <Link> for yew-router (#2877)
* simple NodeRef passing * using `anchor_ref` opposed to `a_ref` per @futursolo's review
This commit is contained in:
parent
ce70e4c1fb
commit
89dd3b3e7f
@ -24,6 +24,9 @@ where
|
||||
pub query: Option<Q>,
|
||||
#[prop_or_default]
|
||||
pub disabled: bool,
|
||||
/// [`NodeRef`](yew::html::NodeRef) for the `<a>` element.
|
||||
#[prop_or_default]
|
||||
pub anchor_ref: NodeRef,
|
||||
#[prop_or_default]
|
||||
pub children: Children,
|
||||
}
|
||||
@ -41,6 +44,7 @@ where
|
||||
children,
|
||||
disabled,
|
||||
query,
|
||||
anchor_ref,
|
||||
} = props.clone();
|
||||
|
||||
let navigator = use_navigator().expect_throw("failed to get navigator");
|
||||
@ -86,6 +90,7 @@ where
|
||||
{href}
|
||||
{onclick}
|
||||
{disabled}
|
||||
ref={anchor_ref}
|
||||
>
|
||||
{ children }
|
||||
</a>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user