Feat: begin WIP on html macro
This commit is contained in:
1 parent
b0a87e5d73
commit
a8b1225c48
11 files changed
+255
-102
No files matched your search
@@ -4,17 +4,38 @@ use dioxus_core::prelude::*;
|
||||
use dioxus_web::*;
|
||||
|
||||
fn main() {
|
||||
// Setup logging
|
||||
wasm_logger::init(wasm_logger::Config::new(log::Level::Debug));
|
||||
// wasm_logger::init(wasm_logger::Config::with_prefix(
|
||||
// log::Level::Debug,
|
||||
// "dioxus_core",
|
||||
// ));
|
||||
console_error_panic_hook::set_once();
|
||||
|
||||
// Run the app
|
||||
wasm_bindgen_futures::spawn_local(WebsysRenderer::start(App));
|
||||
}
|
||||
|
||||
static App: FC<()> = |ctx, _| {
|
||||
ctx.view(html! {
|
||||
<div>
|
||||
<div class="flex items-center justify-center flex-col">
|
||||
<div class="font-bold text-xl"> "Count is {}" </div>
|
||||
<button onclick={move |_| log::info!("button1 clicked!")}> "increment" </button>
|
||||
<button onclick={move |_| log::info!("button2 clicked!")}> "decrement" </button>
|
||||
</div>
|
||||
</div>
|
||||
log::info!("Ran component");
|
||||
use dioxus::builder::*;
|
||||
ctx.view(|b| {
|
||||
div(b)
|
||||
.child(text("hello"))
|
||||
.listeners([on(b, "click", |_| {
|
||||
//
|
||||
log::info!("button1 clicked!");
|
||||
})])
|
||||
.finish()
|
||||
})
|
||||
// ctx.view(html! {
|
||||
// <div onclick={move |_| log::info!("button1 clicked!")}>
|
||||
// "Hello"
|
||||
// // <div class="flex items-center justify-center flex-col">
|
||||
// // <div class="font-bold text-xl"> "Count is ..." </div>
|
||||
// // <button onclick={move |_| log::info!("button1 clicked!")}> "increment" </button>
|
||||
// // <button onclick={move |_| log::info!("button2 clicked!")}> "decrement" </button>
|
||||
// // </div>
|
||||
// </div>
|
||||
// })
|
||||
};
|
||||
Reference in new issue
Block a user