overhaul dioxus fullstack using a new implementation of server_fn This PR is a complete rewrite of dioxus fullstack designed to improve compatibility with axum and to fix a number of compilation errors based on feature flag unification plumbing through macros.
23 lines
649 B
Rust
23 lines
649 B
Rust
//! A simple example on how to use assets loading from the filesystem.
|
|
//!
|
|
//! Dioxus provides the asset!() macro which is a convenient way to load assets from the filesystem.
|
|
//! This ensures the asset makes it into the bundle through dependencies and is accessible in environments
|
|
//! like web and android where assets are lazily loaded using platform-specific APIs.
|
|
|
|
use dioxus::prelude::*;
|
|
|
|
static ASSET_PATH: Asset = asset!("/examples/assets/logo.png");
|
|
|
|
fn main() {
|
|
dioxus::launch(app);
|
|
}
|
|
|
|
fn app() -> Element {
|
|
rsx! {
|
|
div {
|
|
h1 { "This should show an image:" }
|
|
img { src: ASSET_PATH }
|
|
}
|
|
}
|
|
}
|