Dioxus 0.7 × OpenHarmony ArkUI

Arkit

用 Dioxus 组件、Signals 与 Hooks 直接渲染 ArkUI。路由、动画、图表、终端和 shadcn 组件库按 feature 组合,默认只带小内核。

counter/src/lib.rs Rust
use arkit::prelude::*;
 
#[entry]
fn app() -> Element {
let mut count = use_signal(|| 0);
 
rsx! {
column {
width: "100%",
height: "100%",
align_items: "center",
justify_content: "center",
 
text { font_size: 28.0, "count = {count}" }
button {
onclick: move |_| count += 1,
"increment"
}
}
}
}

能力地图

一套 Dioxus 模型,覆盖完整原生应用

Dioxus 原生渲染

以 VirtualDom、signals、hooks 与 rsx! 直接驱动 ArkUI 原生节点,不维护第二套 UI 状态树。

完整应用能力

路由、国际化、动画、Lottie、图表、图标、WebView、GPU 终端与 shadcn 风格组件库开箱即用。

原生性能路径

事件排队、NodeAdapter 虚拟化、Drawing canvas、Lottie NativeWindow 与有界缓存。

OpenHarmony 生命周期

#[entry] 生成 N-API init/render/destroy,并接入窗口、安全区与系统返回键。

运行模型

Dioxus 是唯一的 UI 真相来源

Step 01 业务组件 rsx! · signals · hooks
Step 02 VirtualDom diff · scheduler · events
Step 03 HostTree 确定性 ArkUI 投影
Step 04 原生节点 ArkUI · Drawing · WebView

按需组合

小内核,领域能力显式启用

默认 facade 只带渲染、运行时和核心 hooks。业务通过 Cargo feature 选择领域能力,避免基础应用自动链接完整图表、终端与组件栈。

查看 feature 与公开 API →
默认能力 renderer、runtime、ArkUI elements、hooks、safe area、overlay、WebView
animation 类型化 Timeline、controls、layout/presence、drag、scroll、native lowering
chart 22 类原生 series、ECharts 风格 option/action/event;自动启用 animation
router dioxus-router、原生 Link、系统返回键、页面转场;自动启用 animation
i18n 编译期 Fluent catalog、类型安全消息、响应式 locale
icon 内嵌 Lucide 图标、SVG raster、可配置描边与颜色
lottie ThorVG worker、XComponent 帧同步、NativeWindow 直写;网络源见 lottie-network
camera / camera-scan CameraKit 预览与 JPEG 拍照;camera-scan 增加可配置扫码解码
barcode 独立二维码/条形码生成(rxing),不依赖相机
terminal GPU 加速终端(libghostty-vt),应用自管本地 shell / SSH I/O
shadcn 主题 tokens 与 50+ 业务组件;自动启用 animation、i18n、icon
markdown / code 原生 Markdown 渲染与 tree-sitter 代码高亮;可单独或组合启用
full 启用全部领域能力(含 terminal、barcode、markdown-highlight 等)

从可运行代码开始

13 个示例覆盖从计数器到终端、扫码与图表

查看示例索引