mirror of
https://github.com/DioxusLabs/dioxus
synced 2025-02-17 06:08:26 +00:00
simpilify static generation example
This commit is contained in:
parent
914767892c
commit
0600a1bb49
1 changed files with 0 additions and 60 deletions
|
@ -85,64 +85,6 @@ fn Home(cx: Scope) -> Element {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod inner {
|
|
||||||
use dioxus::prelude::*;
|
|
||||||
use dioxus_router::prelude::*;
|
|
||||||
|
|
||||||
#[rustfmt::skip]
|
|
||||||
#[derive(Clone, Debug, PartialEq, Routable)]
|
|
||||||
pub enum Route {
|
|
||||||
#[nest("/blog")]
|
|
||||||
#[route("/")]
|
|
||||||
Blog {},
|
|
||||||
#[route("/post/index")]
|
|
||||||
PostHome {},
|
|
||||||
#[route("/post/:id")]
|
|
||||||
Post {
|
|
||||||
id: usize,
|
|
||||||
},
|
|
||||||
#[end_nest]
|
|
||||||
#[route("/")]
|
|
||||||
Home {},
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline_props]
|
|
||||||
fn Blog(cx: Scope) -> Element {
|
|
||||||
render! {
|
|
||||||
div {
|
|
||||||
"Blog"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline_props]
|
|
||||||
fn Post(cx: Scope, id: usize) -> Element {
|
|
||||||
render! {
|
|
||||||
div {
|
|
||||||
"PostId: {id}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline_props]
|
|
||||||
fn PostHome(cx: Scope) -> Element {
|
|
||||||
render! {
|
|
||||||
div {
|
|
||||||
"Post"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline_props]
|
|
||||||
fn Home(cx: Scope) -> Element {
|
|
||||||
render! {
|
|
||||||
div {
|
|
||||||
"Home"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[derive(Clone, Debug, PartialEq, Routable)]
|
#[derive(Clone, Debug, PartialEq, Routable)]
|
||||||
enum Route {
|
enum Route {
|
||||||
|
@ -158,6 +100,4 @@ enum Route {
|
||||||
#[end_nest]
|
#[end_nest]
|
||||||
#[route("/")]
|
#[route("/")]
|
||||||
Home {},
|
Home {},
|
||||||
#[child("/hello_world")]
|
|
||||||
HelloWorldRoute(inner::Route)
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue