NavigationMenu
披露式导航界面,包含带方向动画的视口和弹出部件。
正在加载交互演示…
let menu = NavigationMenu::new("docs", &state, &items);
menu.root().flex_row()#导入
从 quickgui 导入 NavigationMenu。
use quickgui::*;#用法
let menu = NavigationMenu::new("docs", &state, &items);
menu.root().flex_row()#结构
NavigationMenu::rootNavigationMenu::listNavigationMenu::itemNavigationMenu::triggerNavigationMenu::iconNavigationMenu::contentNavigationMenu::linkNavigationMenu::portalNavigationMenu::positionerNavigationMenu::popupNavigationMenu::viewportNavigationMenu::arrowNavigationMenu::backdrop
#API 参考
展开条目查看说明和完整签名。短横线表示声明中未记录默认值。
NavigationMenu
查看源码pub fn new( root_id: impl Into<ElementId>, state: &NavigationMenuState, items: &'a [NavigationMenuItem], ) -> SelfCreate a navigation menu over the caller's ordered items. # Panics Panics with more than [`MAX_NAVIGATION_MENU_ITEMS`] items or duplicate item values.
placementpub const fn placement(mut self, placement: AnchorPlacement) -> Self—
Configures placement for this part.
pub const fn placement(mut self, placement: AnchorPlacement) -> Self查看源码loop_focuspub const fn loop_focus(mut self, loop_focus: bool) -> Self—
Wrap from the last trigger to the first. The default is `true`.
pub const fn loop_focus(mut self, loop_focus: bool) -> Self查看源码root_idpub const fn root_id(self) -> ElementId—
itemspub const fn items(self) -> &'a [NavigationMenuItem]—
axispub const fn axis(self) -> NavigationMenuOrientation—
valuepub const fn value(self) -> Option<ElementId>—
roving_valuepub fn roving_value(self) -> Option<ElementId>—
The trigger that owns the bar's single Tab stop. This is the controlled focused value while it names an enabled mounted item, and otherwise the first enabled item, matching the composite-widget convention.
pub fn roving_value(self) -> Option<ElementId>查看源码entrypub fn entry(self, value: impl Into<ElementId>) -> Option<NavigationMenuEntry<'a>>—
Describe one declared item.
pub fn entry(self, value: impl Into<ElementId>) -> Option<NavigationMenuEntry<'a>>查看源码schedulepub fn schedule<V: 'static>(cx: &mut ViewContext<'_, V>, state: &NavigationMenuState)—
Ask for the one repaint an armed open or close deadline needs. Call this while rendering. A settled navigation menu requests nothing, so the window sleeps.
pub fn schedule<V: 'static>(cx: &mut ViewContext<'_, V>, state: &NavigationMenuState)查看源码NavigationMenu::root_with
查看源码pub fn root_with(self, root: Element) -> ElementDecorate an application-owned root without adding layout or appearance.
NavigationMenu::root
查看源码pub fn root(self) -> ElementCreate the unstyled root part. Use [`Self::root_with`] to supply an existing element.
NavigationMenu::list_with
查看源码pub fn list_with(self, list: Element) -> ElementDecorate the application-owned list of items.
NavigationMenu::list
查看源码pub fn list(self) -> ElementCreate the unstyled list part. Use [`Self::list_with`] to supply an existing element.
NavigationMenu::link_with
查看源码pub fn link_with(self, id: impl Into<ElementId>, active: bool, link: Element) -> ElementDecorate an application-owned navigation link without adding appearance. `active` marks the link for the current destination; it projects as the native selected state rather than as a visual class.
NavigationMenu::link
查看源码pub fn link(self, id: impl Into<ElementId>, active: bool) -> ElementCreate the unstyled link part. Use [`Self::link_with`] to supply an existing element.
