Ver Fonte

Add title prop to Link

Every element can have a title, but it's particularly useful on links, so I
think making it an explicit option is worthwhile.
Dave Rolsky há 3 anos atrás
pai
commit
e22ba5b
1 ficheiros alterados com 4 adições e 0 exclusões
  1. 4 0
      packages/router/src/components/link.rs

+ 4 - 0
packages/router/src/components/link.rs

@@ -31,6 +31,9 @@ pub struct LinkProps<'a> {
     #[props(default, strip_option)]
     id: Option<&'a str>,
 
+    #[props(default, strip_option)]
+    title: Option<&'a str>,
+
     children: Element<'a>,
 
     #[props(default)]
@@ -44,6 +47,7 @@ pub fn Link<'a>(cx: Scope<'a, LinkProps<'a>>) -> Element {
             href: "{cx.props.to}",
             class: format_args!("{}", cx.props.class.unwrap_or("")),
             id: format_args!("{}", cx.props.id.unwrap_or("")),
+            title: format_args!("{}", cx.props.title.unwrap_or("")),
 
             prevent_default: "onclick",
             onclick: move |_| service.push_route(cx.props.to),