Tweak launch cfg
This commit is contained in:
3 files changed
+18
-24
No files matched your search
+3
-3
@@ -9,7 +9,7 @@ fn main() {
|
|||||||
|
|
||||||
fn app() -> Element {
|
fn app() -> Element {
|
||||||
let mut counters = use_signal(|| vec![0, 0, 0]);
|
let mut counters = use_signal(|| vec![0, 0, 0]);
|
||||||
let mut sum = use_selector(move || counters.read().iter().copied().sum::<usize>());
|
let sum = use_selector(move || counters.read().iter().copied().sum::<i32>());
|
||||||
|
|
||||||
rsx! {
|
rsx! {
|
||||||
div {
|
div {
|
||||||
@@ -29,14 +29,14 @@ fn app() -> Element {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
fn Child(i: usize, counters: Signal<Vec<usize>>) -> Element {
|
fn Child(i: usize, counters: Signal<Vec<i32>>) -> Element {
|
||||||
rsx! {
|
rsx! {
|
||||||
li {
|
li {
|
||||||
button { onclick: move |_| counters.write()[i] -= 1, "-1" }
|
button { onclick: move |_| counters.write()[i] -= 1, "-1" }
|
||||||
input {
|
input {
|
||||||
value: "{counters.read()[i]}",
|
value: "{counters.read()[i]}",
|
||||||
oninput: move |e| {
|
oninput: move |e| {
|
||||||
if let Ok(value) = e.value().parse::<usize>() {
|
if let Ok(value) = e.value().parse::<i32>() {
|
||||||
counters.write()[i] = value;
|
counters.write()[i] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ fn app() -> Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type SthElse<T> = Option<T>;
|
|
||||||
|
|
||||||
#[derive(Props, PartialEq, Clone)]
|
#[derive(Props, PartialEq, Clone)]
|
||||||
struct ButtonProps {
|
struct ButtonProps {
|
||||||
a: String,
|
a: String,
|
||||||
@@ -51,6 +49,8 @@ struct ButtonProps {
|
|||||||
e: SthElse<String>,
|
e: SthElse<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SthElse<T> = Option<T>;
|
||||||
|
|
||||||
fn Button(props: ButtonProps) -> Element {
|
fn Button(props: ButtonProps) -> Element {
|
||||||
rsx! {
|
rsx! {
|
||||||
button {
|
button {
|
||||||
|
|||||||
@@ -67,19 +67,7 @@ impl LaunchBuilder {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::unit_arg)]
|
#[cfg(feature = "web")]
|
||||||
/// Launch the app.
|
|
||||||
pub fn launch(self) {
|
|
||||||
current_platform::launch(
|
|
||||||
self.cross_platform_config,
|
|
||||||
Default::default(),
|
|
||||||
self.platform_config.unwrap_or_default(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "web")]
|
|
||||||
impl LaunchBuilder {
|
|
||||||
/// Launch your web application.
|
/// Launch your web application.
|
||||||
pub fn launch_web(self) {
|
pub fn launch_web(self) {
|
||||||
dioxus_web::launch::launch(
|
dioxus_web::launch::launch(
|
||||||
@@ -88,11 +76,9 @@ impl LaunchBuilder {
|
|||||||
Default::default(),
|
Default::default(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "desktop")]
|
|
||||||
impl LaunchBuilder {
|
|
||||||
/// Launch your desktop application.
|
/// Launch your desktop application.
|
||||||
|
#[cfg(feature = "desktop")]
|
||||||
pub fn launch_desktop(self) {
|
pub fn launch_desktop(self) {
|
||||||
dioxus_desktop::launch::launch(
|
dioxus_desktop::launch::launch(
|
||||||
self.cross_platform_config,
|
self.cross_platform_config,
|
||||||
@@ -100,11 +86,9 @@ impl LaunchBuilder {
|
|||||||
Default::default(),
|
Default::default(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "fullstack")]
|
|
||||||
impl LaunchBuilder {
|
|
||||||
/// Launch your fullstack application.
|
/// Launch your fullstack application.
|
||||||
|
#[cfg(feature = "fullstack")]
|
||||||
pub fn launch_fullstack(self) {
|
pub fn launch_fullstack(self) {
|
||||||
dioxus_fullstack::launch::launch(
|
dioxus_fullstack::launch::launch(
|
||||||
self.cross_platform_config,
|
self.cross_platform_config,
|
||||||
@@ -112,6 +96,16 @@ impl LaunchBuilder {
|
|||||||
Default::default(),
|
Default::default(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::unit_arg)]
|
||||||
|
/// Launch the app.
|
||||||
|
pub fn launch(self) {
|
||||||
|
current_platform::launch(
|
||||||
|
self.cross_platform_config,
|
||||||
|
Default::default(),
|
||||||
|
self.platform_config.unwrap_or_default(),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod current_platform {
|
mod current_platform {
|
||||||
|
|||||||
Reference in new issue
Block a user