跳到正文

View

用于布局、绘制、指针输入和无障碍支持的通用保留式容器。

正在加载交互演示…

#导入

从 quickgui 导入 div。

use quickgui::*;

#用法

div()
    .p(20.0)
    .gap(12.0)
    .child(text("Hello from Rust"))
    .child(button().on_click(continue_clicked).child("Continue"))

#API 参考

展开条目查看说明和完整签名。短横线表示声明中未记录默认值。

pub fn div() -> Element

Create a container element.

bgpub fn bg(mut self, color: Color) -> Self—

Configures bg for this part.

pub fn bg(mut self, color: Color) -> Self
查看源码
pxpub fn px(mut self, value: f32) -> Self—

Configures px for this part.

pub fn px(mut self, value: f32) -> Self
查看源码
hoverpub fn hover(mut self, style: impl FnOnce(ElementStateStyle) -> ElementStateStyle) -> Self—

Configures hover for this part.

pub fn hover(mut self, style: impl FnOnce(ElementStateStyle) -> ElementStateStyle) -> Self
查看源码
childpub fn child(mut self, child: impl IntoElement) -> Self—

Configures child for this part.

pub fn child(mut self, child: impl IntoElement) -> Self
查看源码
on_clickpub fn on_click<V>(mut self, listener: crate::ClickListener<V>) -> Self—

Attach a listener registered by [`crate::ViewContext::listener`].

pub fn on_click<V>(mut self, listener: crate::ClickListener<V>) -> Self
查看源码
idpub fn id(mut self, id: impl Into<ElementId>) -> Self—

Configures id for this part.

pub fn id(mut self, id: impl Into<ElementId>) -> Self
查看源码