跳转到内容

pivotick v3.0.0


拓展 / AsyncContent / AsyncContentOptions

接口: AsyncContentOptions ​

定义于:interfaces/AsyncContent.ts:94

当内容挂钩的承诺正在执行时,库会显示什么,如果该承诺被拒绝,它会显示什么。两者都是可选的——内置框架和错误可供性遵循活动主题。

同步钩子永远不会看到其中任何一个:它们在同一帧中提交,就像它们总是做的那样。

示例 ​

ts
UI: {
    asyncContent: {
        placeholder: (surface) => surface === 'tooltip' ? 'Loading…' : mySkeleton(),
        error: 'Could not load',
    },
}

属性 ​

error? ​

optional error: Renderable | (surface, error) => Renderable

定义于:interfaces/AsyncContent.ts:105

当异步钩子拒绝时在槽中显示。中止的渲染并不是失败,并且永远不会达到此目的。

默认值 ​

ts
a compact themed error line

placeholder? ​

optional placeholder: Renderable | (surface) => Renderable

定义于:interfaces/AsyncContent.ts:99

当异步挂钩挂起时显示在槽中。

默认值 ​

ts
a themed skeleton