mirror of
https://github.com/leptos-rs/leptos.git
synced 2025-12-29 02:31:50 -05:00
Compare commits
1 Commits
4079
...
document-a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d7fe46661 |
@@ -66,6 +66,25 @@ where
|
||||
/// This is helpful for accessibility and for styling. For example, maybe you want to set the link a
|
||||
/// different color if it’s a link to the page you’re currently on.
|
||||
///
|
||||
/// ### Additional Attributes
|
||||
///
|
||||
/// You can add additional HTML attributes to the `<a>` element created by this component using the attribute
|
||||
/// spreading syntax for components. For example, to add a class, you can use `attr:class="my-link"`.
|
||||
/// Alternately, you can add any number of HTML attributes (include `class`) after a `{..}` marker.
|
||||
///
|
||||
/// ```rust
|
||||
/// # use leptos::prelude::*; use leptos_router::components::A;
|
||||
/// # fn spread_example() -> impl IntoView {
|
||||
/// view! {
|
||||
/// <A href="/about" attr:class="my-link" {..} id="foo">"Some link"</A>
|
||||
/// <A href="/about" {..} class="my-link" id="bar">"Another link"</A>
|
||||
/// <A href="/about" {..} class:my-link=true id="baz">"One more"</A>
|
||||
/// }
|
||||
/// # }
|
||||
/// ```
|
||||
///
|
||||
/// For more information on this attribute spreading syntax, [see here](https://book.leptos.dev/view/03_components.html#spreading-attributes-onto-components).
|
||||
///
|
||||
/// ### DOM Properties
|
||||
///
|
||||
/// `<a>` elements can take several additional DOM properties with special meanings.
|
||||
|
||||
@@ -709,7 +709,7 @@ where
|
||||
|
||||
buf.push('<');
|
||||
buf.push_str(E::TAG);
|
||||
<At as ToTemplate>::to_template_attribute(
|
||||
<At as ToTemplate>::to_template(
|
||||
buf,
|
||||
&mut class,
|
||||
&mut style,
|
||||
|
||||
@@ -437,17 +437,6 @@ pub trait ToTemplate {
|
||||
inner_html: &mut String,
|
||||
position: &mut Position,
|
||||
);
|
||||
|
||||
/// Renders a view type to a template in attribute position.
|
||||
fn to_template_attribute(
|
||||
buf: &mut String,
|
||||
class: &mut String,
|
||||
style: &mut String,
|
||||
inner_html: &mut String,
|
||||
position: &mut Position,
|
||||
) {
|
||||
Self::to_template(buf, class, style, inner_html, position);
|
||||
}
|
||||
}
|
||||
|
||||
/// Keeps track of what position the item currently being hydrated is in, relative to its siblings
|
||||
|
||||
@@ -103,15 +103,6 @@ impl ToTemplate for () {
|
||||
) {
|
||||
buf.push_str("<!>");
|
||||
}
|
||||
|
||||
fn to_template_attribute(
|
||||
_buf: &mut String,
|
||||
_class: &mut String,
|
||||
_style: &mut String,
|
||||
_inner_html: &mut String,
|
||||
_position: &mut Position,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
impl<A: Render> Render for (A,) {
|
||||
|
||||
Reference in New Issue
Block a user