6个版本 (3个重大变更)
0.4.1 | 2023年12月4日 |
---|---|
0.4.0 |
|
0.3.0 | 2023年10月30日 |
0.2.2 | 2023年5月22日 |
0.1.0 | 2023年5月21日 |
#366 在 WebAssembly
350 每月下载量
13KB
245 行
yew-autoprops
用于为Yew组件自动从参数推导属性结构体的proc-macro
不再需要额外的Props结构体!
示例
use yew_autoprops::autoprops;
use yew::prelude::*;
#[autoprops]
#[function_component]
fn CoolComponent(#[prop_or_default] hidden: bool, smth: &AttrValue) -> Html {
html! {
<div class={classes!(hidden.then_some("hidden"))}>
<p>{ smth }</p>
</div>
}
}
use yew_autoprops::autoprops;
use yew::prelude::*;
#[autoprops(CoolComponentProps)]
#[function_component(CoolComponent)]
fn cool_component(#[prop_or_default] hidden: bool, smth: &AttrValue) -> Html {
html! {
<div class={classes!(hidden.then_some("hidden"))}>
<p>{ smth }</p>
</div>
}
}
依赖关系
~325–790KB
~19K SLoC