<tap-stack>

类似 iOS 的堆栈导航,推入的页面从右侧滑入,从左边缘向右滑动关闭。 页面默认会推入历史记录栈,所以浏览器或系统的返回按钮也能关闭页面。

Example

import { Stack } from '@mantou/tap-ui/elements/stack';

// 推入页面到全局根堆栈
Stack.push({
  content: html`<my-detail-page></my-detail-page>`,
});

// 关闭顶部页面
Stack.pop();

在元素中使用最近的堆栈,例如 sheet 中的堆栈:

Stack.getClosestStack(this)?.push({ content: html`<my-profile-page></my-profile-page>` });

API

Extends GemElement

Static Properties

Property Type
instance TapStackElement | undefined

Static Methods

Method Type
push (options: StackPushOptions) => void
replace (options: StackPushOptions, replaceOptions?: StackReplaceOptions) => void
pop (options?: StackPopOptions) => void
inCurrentStack (ele: HTMLElement) => boolean
getClosestStack (ele?: Element) => TapStackElement | undefined

Instance Properties

Property(Attribute) Reactive Type Description
disableHistory(disable-history) Yes boolean
autoHeight(auto-height) Yes boolean
maxHeight(max-height) Yes number
rootClose Emitter<null> Closing the root page: pop() with only the root page left, or swiping back on it; the root page stays, and nothing is below it, so it doesn't follow the finger
get store ((value?: Partial<{ pages: StackPushOptions[]; offset: number; sheetProgress: number; }> | undefined) => void) & Omit<{ [Symbol.metadata]: never; name: never; apply: never; call: never; ... 6 more ...; [Symbol.hasInstance]: never; }, "offset" | ... 1 more ... | "sheetProgress"> & ...

Instance Methods

Method Type
push (options: StackPushOptions) => void
replace (options: StackPushOptions, { keep }?: StackReplaceOptions) => void
pop (options?: StackPopOptions) => void

Other

Type Value
Event root-close