♻️ (pagetop): Incorpora Context al render de Props
This commit is contained in:
parent
a2b3ae2eb8
commit
ab1d4f0efb
49 changed files with 212 additions and 133 deletions
|
|
@ -23,15 +23,15 @@
|
|||
//! puedes usar [`Props`](pagetop::html::Props) combinado con las constantes de este módulo:
|
||||
//!
|
||||
//! ```rust,no_run
|
||||
//! use pagetop::prelude::*;
|
||||
//! use pagetop_htmx::prelude::*;
|
||||
//!
|
||||
//! # use pagetop::prelude::*;
|
||||
//! # use pagetop_htmx::prelude::*;
|
||||
//! # let cx = Context::default();
|
||||
//! let props = Props::new(hx::GET, "/api/items")
|
||||
//! .with_prop(PropsOp::set(hx::TARGET, "#list"))
|
||||
//! .with_prop(PropsOp::set(hx::SWAP, hx::swap::OUTER_HTML));
|
||||
//!
|
||||
//! let markup = html! {
|
||||
//! button (props) { "Load" }
|
||||
//! button (props.unpack(&cx)) { "Load" }
|
||||
//! };
|
||||
//! ```
|
||||
//!
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@ async fn homepage(request: HttpRequest) -> Result<Markup, ErrorPage> {
|
|||
.with_prop(PropsOp::set(hx::TARGET, "#result"));
|
||||
|
||||
Page::new(request)
|
||||
.with_child(Html::with(move |_| html! {
|
||||
button (props) { "Say hello" }
|
||||
.with_child(Html::with(move |cx| html! {
|
||||
button (props.unpack(cx)) { "Say hello" }
|
||||
div #result {}
|
||||
}))
|
||||
.render().await
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue