2023-12-17 23:14:55 +00:00
|
|
|
use dioxus::prelude::*;
|
2024-01-06 02:08:04 +00:00
|
|
|
use dioxus_desktop::{use_asset_handler, wry::http::Response};
|
2023-12-17 23:14:55 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
dioxus_desktop::launch(app);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn app(cx: Scope) -> Element {
|
2024-01-06 02:08:04 +00:00
|
|
|
use_asset_handler(cx, "logos", |request, response| {
|
|
|
|
// Note that the "logos" prefix is stripped from the URI
|
|
|
|
//
|
|
|
|
// However, the asset is absolute to its "virtual folder" - meaning it starts with a leading slash
|
|
|
|
if request.uri().path() != "/logo.png" {
|
|
|
|
return;
|
2023-12-17 23:14:55 +00:00
|
|
|
}
|
2024-01-06 02:08:04 +00:00
|
|
|
|
|
|
|
response.respond(Response::new(include_bytes!("./assets/logo.png").to_vec()));
|
2023-12-17 23:14:55 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
cx.render(rsx! {
|
|
|
|
div {
|
|
|
|
img {
|
2024-01-06 02:08:04 +00:00
|
|
|
src: "/logos/logo.png"
|
2023-12-17 23:14:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|