何时使用
App 将 MessageHolder、NotificationHolder 和 ModalHolder 结合在一个应用程序区域中。子组件通过 App.useApp() 或单独的 useApp() 接收响应 API。对于本地独立队列,您仍然可以使用 createMessage/createNotification/createModal 和您自己的持有者。
获取上下文
将 ConfigProvider 作为子组件放置在 App 和 API 使用者之外。 基本示例 由 Basic.svelte 和 Actions.svelte 组成:第一个定义范围,第二个在初始化时调用 App.useApp()。卡源包含两个带签名的文件;分别保存。
AppInstance 包含稳定的 message、notification 和模态。它们可以在初始化期间获取,然后从处理程序中调用。不要在处理程序或仅呈现下面的应用程序的父级中调用 useApp:它尚无权访问子级上下文。无需为相同的 API 重复使用手动支架。
| 回应 | 应用程序接口 | 详情 |
|---|---|---|
| 短信 | message.open/info/success/error/warning/loading |
message |
| 活动详情 | notification.open/info/success/error/warning |
notification |
| 用户决定 | modal.info/success/error/warning/确认 |
Modal |
默认和独立队列
App上的 message 和 notification 设置默认。设置按字段与最近的App组合; local undefined 也会覆盖父字段并返回 default 持有者。特定的消息/通知配置具有更高的优先级。
更新设置 不会重新启动计时器或删除打开的条目。 duration、pauseOnHover、maxCount 和 notification.placement 适用于后续调用。新的 maxCount 限制了队列的下一次添加;现有通知保留其 placement。top/bottom 改变相应表面的位置。
App.message 支持 stack、getContainer、rtl、transitionName、classNames 和 styles 等列表选项。阈值为二时,第三条消息会使列表折叠,悬停可查看全部三条消息。消息挂载位置。
在默认设置示例中启用六秒后关闭。下一条通知会采用 App.notification 的 duration 和 showProgress,已打开卡片的位置和计时不受影响。
嵌套应用程序 继承了设置,但具有独立的队列和模态控制器。清除嵌套范围不会删除父级的响应。当您确实需要一个单独的区域时,请添加一个应用程序;普通的子组件需要最接近的 API。
的根源、主题和生命周期
App 默认渲染 div。component 接受 HTML 标签名、Svelte 组件或 false。自定义根节点示例向组件传入标题和 HTML 属性。根组件渲染包含 holders 的 children,并通过 $bindable() 和 bind:this 暴露 DOM 元素。AppRootProps 类型描述根组件的通用属性。在片段模式下,nativeElement 为 undefined。切换根节点会重新创建子 DOM 并清空 holders。App 实例的方法仍可使用。
ConfigProvider.app 指定包装器的 class/style。 undefined 继承了record,它自己的对象,包括{},完全取代了它。提供者类和实例类是相加的;当地 style 排在最后。这些规则不同于按字段组合 message/notification。非空本地 prefixCls 指定 App 类,否则使用基本前缀 ConfigProvider + app。空字符串继承提供者的后备。
响应的主题、区域设置和方向属于应用程序放置持有者的 ConfigProvider。在 SSR 应用程序中,不会打开对话框/弹出窗口,也不会启动计时器。删除区域会关闭曲面,释放模态,并以 false 终止待处理的模态句柄。不要在请求之间将共享的 AppInstance 存储在服务器模块中;将特定于实例的 API 传递给所需的应用程序处理程序。
ConfigProvider.prefixCls 更改了 App 和其他连接系列的类;他们的列表在 ConfigProvider 页面上给出。无论 App.prefixCls 如何,message/notification/Modal 都会继承公共前缀。 CSS 响应前缀 显示单独的 message.prefixCls 和 notification.prefixCls。空行将它们返回给 ConfigProvider。
App 的外观使用当前主题的设计令牌(design tokens)。
示例
通过应用程序回复
来自子 App.useApp() 的message、notification和模态。源代码包含 Basic.svelte 和 Actions.svelte。
Basic.svelte<script lang="ts"> import { App, ConfigProvider } from '@woodger/antd'; import Actions from './Actions.svelte'; </script> <ConfigProvider> <App message={({ top: 180 })} notification={{ placement: 'bottomRight' }}> <Actions scope={("基本的")} /> </App> </ConfigProvider>Actions.svelte<script lang="ts"> import { App, Button } from '@woodger/antd'; let { scope = 'App' }: { scope?: string } = $props(); const api = App.useApp(); let messages = 0; let notifications = 0; let result = $state(("无解")); async function confirm() { const accepted = await api.modal.confirm(({ title: `确认 (${scope})`, content: "窗口和响应属于最近的应用程序。" })); result = accepted ? ("确认的") : ("取消"); } function clear() { api.message.destroy(); api.notification.destroy(); } </script> <style> .actions { display: flex; flex-wrap: wrap; gap: 8px; } .actions :global(.ant-btn) { max-width: 100%; height: auto; white-space: normal; } output { display: block; margin-top: 12px; overflow-wrap: anywhere; } </style> <div class="actions"> <Button onclick={() => api.message.info((`${scope}: 信息 ${++messages}`))} >{("\n 信息 (")}{(scope)}) </Button> <Button onclick={() => api.notification.info(({ title: `${scope}: 通知 ${++notifications}`, description: "来自 App.useApp() 的 API" }))}>{("通知 (")}{(scope)})</Button> <Button onclick={confirm}>{("确认 (")}{(scope)})</Button> <Button onclick={clear}>{("清除 (")}{(scope)})</Button> </div> <output aria-label={("应用解决方案(" + String((scope)) + ")")}>{result}</output>
新的限制将在您下次添加时应用。打开通知保存位置。
响应设置
新的默认值不会重新启动打开的记录。两个文件:Defaults.svelte 和 Actions.svelte。
Defaults.svelte<script lang="ts"> import { App, Checkbox, ConfigProvider } from '@woodger/antd'; import Actions from './Actions.svelte'; let single = $state(false); let bottom = $state(true); let timed = $state(false); </script> <style> .example { display: grid; gap: 16px; } .controls { display: flex; flex-wrap: wrap; gap: 12px; } p { margin: 0; } </style> <div class="example"> <div class="controls"> <Checkbox bind:checked={single}>{("留言限制:1条")}</Checkbox> <Checkbox bind:checked={bottom}>{("以下通知")}</Checkbox> <Checkbox bind:checked={timed}> {("6 秒后关闭通知")} </Checkbox> </div> <ConfigProvider> <App message={{ maxCount: single ? 1 : 3, duration: 0, top: 180, stack: { threshold: 2 } }} notification={{ placement: bottom ? 'bottomRight' : 'topRight', duration: timed ? 6 : 0, showProgress: timed, top: 180 }}> <Actions scope={("设置")} /> </App> </ConfigProvider> <p>{("新的限制将在您下次添加时应用。打开通知保存位置。")}</p> </div>Actions.svelte<script lang="ts"> import { App, Button } from '@woodger/antd'; let { scope = 'App' }: { scope?: string } = $props(); const api = App.useApp(); let messages = 0; let notifications = 0; let result = $state(("无解")); async function confirm() { const accepted = await api.modal.confirm(({ title: `确认 (${scope})`, content: "窗口和响应属于最近的应用程序。" })); result = accepted ? ("确认的") : ("取消"); } function clear() { api.message.destroy(); api.notification.destroy(); } </script> <style> .actions { display: flex; flex-wrap: wrap; gap: 8px; } .actions :global(.ant-btn) { max-width: 100%; height: auto; white-space: normal; } output { display: block; margin-top: 12px; overflow-wrap: anywhere; } </style> <div class="actions"> <Button onclick={() => api.message.info((`${scope}: 信息 ${++messages}`))} >{("\n 信息 (")}{(scope)}) </Button> <Button onclick={() => api.notification.info(({ title: `${scope}: 通知 ${++notifications}`, description: "来自 App.useApp() 的 API" }))}>{("通知 (")}{(scope)})</Button> <Button onclick={confirm}>{("确认 (")}{(scope)})</Button> <Button onclick={clear}>{("清除 (")}{(scope)})</Button> </div> <output aria-label={("应用解决方案(" + String((scope)) + ")")}>{result}</output>
外部区域
嵌套区域继承默认值,但有自己的队列。
独立地区
嵌套应用程序继承默认字段并创建自己的队列。两个文件:Nested.svelte 和 Actions.svelte。
Nested.svelte<script lang="ts"> import { App, ConfigProvider } from '@woodger/antd'; import Actions from './Actions.svelte'; </script> <style> .nested { margin-top: 20px; padding: 16px; border: 1px solid var(--ant-color-border-secondary); border-radius: 8px; } p { margin: 0 0 12px; } </style> <ConfigProvider> <App message={({ duration: 0, maxCount: 2, top: 180 })} notification={{ duration: 0, placement: 'bottomLeft' }}> <p>{("外部区域")}</p> <Actions scope={("外部的")} /> <div class="nested"> <App message={({ top: 240 })} notification={{ placement: 'bottomRight' }}> <p>{("嵌套区域继承默认值,但有自己的队列。")}</p> <Actions scope={("嵌套")} /> </App> </div> </App> </ConfigProvider>Actions.svelte<script lang="ts"> import { App, Button } from '@woodger/antd'; let { scope = 'App' }: { scope?: string } = $props(); const api = App.useApp(); let messages = 0; let notifications = 0; let result = $state(("无解")); async function confirm() { const accepted = await api.modal.confirm(({ title: `确认 (${scope})`, content: "窗口和响应属于最近的应用程序。" })); result = accepted ? ("确认的") : ("取消"); } function clear() { api.message.destroy(); api.notification.destroy(); } </script> <style> .actions { display: flex; flex-wrap: wrap; gap: 8px; } .actions :global(.ant-btn) { max-width: 100%; height: auto; white-space: normal; } output { display: block; margin-top: 12px; overflow-wrap: anywhere; } </style> <div class="actions"> <Button onclick={() => api.message.info((`${scope}: 信息 ${++messages}`))} >{("\n 信息 (")}{(scope)}) </Button> <Button onclick={() => api.notification.info(({ title: `${scope}: 通知 ${++notifications}`, description: "来自 App.useApp() 的 API" }))}>{("通知 (")}{(scope)})</Button> <Button onclick={confirm}>{("确认 (")}{(scope)})</Button> <Button onclick={clear}>{("清除 (")}{(scope)})</Button> </div> <output aria-label={("应用解决方案(" + String((scope)) + ")")}>{result}</output>
发布操作
更改标签或片段会重新创建子 DOM 并清除持有者。
根和片段
FeedbackSection 接收标题,并通过 bind:nativeElement 暴露 section 元素。勾选复选框可切换到片段模式。
Root.svelte<script lang="ts"> import { App, Checkbox, ConfigProvider } from '@woodger/antd'; import Actions from './Actions.svelte'; import FeedbackSection from './FeedbackSection.svelte'; let fragment = $state(false); let nativeElement = $state<HTMLElement>(); </script> <style> .example { display: grid; gap: 16px; } p { margin: 0; } </style> <div class="example"> <Checkbox bind:checked={fragment}>{("没有应用程序包装器")}</Checkbox> <ConfigProvider> <App component={fragment ? false : FeedbackSection} heading={("发布操作")} prefixCls="woodger-app" aria-label={("应用区")} bind:nativeElement message={({ duration: 0, top: 180 })} style=" padding: 16px; border: 1px dashed currentColor; "> <Actions scope={("根")} /> </App> </ConfigProvider> <output aria-label={("根应用程序")}>{(nativeElement?.tagName.toLowerCase() ?? "不")}</output> <p>{("更改标签或片段会重新创建子 DOM 并清除持有者。")}</p> </div>FeedbackSection.svelte<script lang="ts"> import type { AppRootProps } from '@woodger/antd'; let { heading, children, nativeElement = $bindable(), ...attributes }: AppRootProps & { heading: string } = $props(); </script> <section {...attributes} bind:this={nativeElement}> <h3>{heading}</h3> {@render children?.()} </section>Actions.svelte<script lang="ts"> import { App, Button } from '@woodger/antd'; let { scope = 'App' }: { scope?: string } = $props(); const api = App.useApp(); let messages = 0; let notifications = 0; let result = $state(("无解")); async function confirm() { const accepted = await api.modal.confirm(({ title: `确认 (${scope})`, content: "窗口和响应属于最近的应用程序。" })); result = accepted ? ("确认的") : ("取消"); } function clear() { api.message.destroy(); api.notification.destroy(); } </script> <style> .actions { display: flex; flex-wrap: wrap; gap: 8px; } .actions :global(.ant-btn) { max-width: 100%; height: auto; white-space: normal; } output { display: block; margin-top: 12px; overflow-wrap: anywhere; } </style> <div class="actions"> <Button onclick={() => api.message.info((`${scope}: 信息 ${++messages}`))} >{("\n 信息 (")}{(scope)}) </Button> <Button onclick={() => api.notification.info(({ title: `${scope}: 通知 ${++notifications}`, description: "来自 App.useApp() 的 API" }))}>{("通知 (")}{(scope)})</Button> <Button onclick={confirm}>{("确认 (")}{(scope)})</Button> <Button onclick={clear}>{("清除 (")}{(scope)})</Button> </div> <output aria-label={("应用解决方案(" + String((scope)) + ")")}>{result}</output>
应用程序排版和本地填充。
空的应用程序记录会替换祖先的默认值。
应用程序设计
ConfigProvider.app、本地样式、空记录和别名。两个文件:Config.svelte 和 Actions.svelte。
Config.svelte<script lang="ts"> import { App, ConfigProvider } from '@woodger/antd'; import Actions from './Actions.svelte'; </script> <style> .example { display: grid; gap: 16px; } p { margin: 0 0 12px; } </style> <ConfigProvider app={{ class: 'app-defaults', style: ` padding: 16px; border-radius: 8px; ` }} theme={{ components: { App: { colorText: '#237804', fontSize: 16, lineHeight: 1.8 } } }}> <div class="example"> <App class="app-local" style="padding: 8px" aria-label={("具有默认值的应用程序")} message={({ top: 180 })}> <p>{("应用程序排版和本地填充。")}</p> <Actions scope={("登记")} /> </App> <ConfigProvider app={{}}> <App aria-label={("没有默认值的应用程序")}> <p>{("空的应用程序记录会替换祖先的默认值。")}</p> </App> </ConfigProvider> </div> </ConfigProvider>Actions.svelte<script lang="ts"> import { App, Button } from '@woodger/antd'; let { scope = 'App' }: { scope?: string } = $props(); const api = App.useApp(); let messages = 0; let notifications = 0; let result = $state(("无解")); async function confirm() { const accepted = await api.modal.confirm(({ title: `确认 (${scope})`, content: "窗口和响应属于最近的应用程序。" })); result = accepted ? ("确认的") : ("取消"); } function clear() { api.message.destroy(); api.notification.destroy(); } </script> <style> .actions { display: flex; flex-wrap: wrap; gap: 8px; } .actions :global(.ant-btn) { max-width: 100%; height: auto; white-space: normal; } output { display: block; margin-top: 12px; overflow-wrap: anywhere; } </style> <div class="actions"> <Button onclick={() => api.message.info((`${scope}: 信息 ${++messages}`))} >{("\n 信息 (")}{(scope)}) </Button> <Button onclick={() => api.notification.info(({ title: `${scope}: 通知 ${++notifications}`, description: "来自 App.useApp() 的 API" }))}>{("通知 (")}{(scope)})</Button> <Button onclick={confirm}>{("确认 (")}{(scope)})</Button> <Button onclick={clear}>{("清除 (")}{(scope)})</Button> </div> <output aria-label={("应用解决方案(" + String((scope)) + ")")}>{result}</output>
App.prefixCls 指的是包装器。消息和通知在其记录中指定完整的本地前缀;空字符串继承ConfigProvider。 Modal单独继承公共前缀或者在确认配置中接收prefixCls。
应用程序响应 CSS 前缀
保存打开响应时的通用前缀和单独的message/notification设置。
Prefix.svelte<script lang="ts"> import { App, Checkbox, ConfigProvider } from '@woodger/antd'; import Actions from './Actions.svelte'; let custom = $state(true); let local = $state(true); </script> <style> .example { display: grid; gap: 16px; min-width: 0; } .controls { display: flex; flex-wrap: wrap; gap: 12px; } p { margin: 0; } </style> <div class="example"> <div class="controls"> <Checkbox bind:checked={custom}>{("通用应用程序套件前缀")}</Checkbox> <Checkbox bind:checked={local}>{("本地应用程序响应前缀")}</Checkbox> </div> <ConfigProvider prefixCls={custom ? 'suite' : 'ant'} theme={{ cssVar: { prefix: 'app-prefix-theme' } }}> <App prefixCls="project-app" message={({ prefixCls: local ? 'project-message' : '', duration: 0, top: 240 })} notification={{ prefixCls: local ? 'project-notification' : '', duration: 0, top: 240 }}> <Actions scope={("前缀")} /> </App> </ConfigProvider> <p> {("App.prefixCls 指的是包装器。消息和通知在其记录中指定完整的本地前缀;空字符串继承ConfigProvider。 Modal单独继承公共前缀或者在确认配置中接收prefixCls。")} </p> </div>Actions.svelte<script lang="ts"> import { App, Button } from '@woodger/antd'; let { scope = 'App' }: { scope?: string } = $props(); const api = App.useApp(); let messages = 0; let notifications = 0; let result = $state(("无解")); async function confirm() { const accepted = await api.modal.confirm(({ title: `确认 (${scope})`, content: "窗口和响应属于最近的应用程序。" })); result = accepted ? ("确认的") : ("取消"); } function clear() { api.message.destroy(); api.notification.destroy(); } </script> <style> .actions { display: flex; flex-wrap: wrap; gap: 8px; } .actions :global(.ant-btn) { max-width: 100%; height: auto; white-space: normal; } output { display: block; margin-top: 12px; overflow-wrap: anywhere; } </style> <div class="actions"> <Button onclick={() => api.message.info((`${scope}: 信息 ${++messages}`))} >{("\n 信息 (")}{(scope)}) </Button> <Button onclick={() => api.notification.info(({ title: `${scope}: 通知 ${++notifications}`, description: "来自 App.useApp() 的 API" }))}>{("通知 (")}{(scope)})</Button> <Button onclick={confirm}>{("确认 (")}{(scope)})</Button> <Button onclick={clear}>{("清除 (")}{(scope)})</Button> </div> <output aria-label={("应用解决方案(" + String((scope)) + ")")}>{result}</output>
API
目的、配置、嵌套和片段均通过官方App页面进行验证。下面的合约和片段属于公共 Svelte API。
| 主题 | 示例或限制 |
|---|---|
| Basic | 子 App.useApp 接收 message、notification 和模式。 |
| Hooks config | 常规队列设置和反应性默认值更新。 |
| Sequence with ConfigProvider | 应用程序外部的提供者设置主题和 class/style 默认值。 |
| Embedded usage scenarios | 设置跨字段继承;队列保持独立。 |
| component=false | 没有 root 的片段,bind:nativeElement 和更改模式时的清理。 |
| Global scene | API 在子组件中接收。服务器模块中未创建公共队列。 |
App
| 属性 | 描述 | 类型 | 默认 |
|---|---|---|---|
children | 可以访问最近的应用程序的子树。 | Snippet | — |
component | HTML 标签、带有自定义属性的 Svelte 组件,或表示片段的 false。切换根节点时,App 会重新创建其内容和 holders。 | keyof HTMLElementTagNameMap | Component<Props> | false | div |
message | 消息队列默认值;本地字段补充父字段。 | AppMessageConfig | 从最近的应用程序 |
notification | 默认通知和表面位置。 | AppNotificationConfig | 从最近的应用程序 |
prefixCls | 完整的根前缀;非空 prop 优先于一般 prop。undefined/空字符串使用基本前缀 ConfigProvider + app。 | string | ConfigProvider / ant-app |
class | 从 ConfigProvider.app 扩展该类。 | string | — |
rootClassName | 附加根类。 | string | — |
style | 主题和 ConfigProvider.app.style 之后的本地 CSS。 | string | — |
nativeElement | 根 DOM 元素。自定义根组件通过 $bindable() 暴露该元素。在片段模式下和卸载后,其值为 undefined。 | HTMLElement | undefined | undefined |
AppMessageConfig
| 属性 | 描述 | 类型 | 默认 |
|---|---|---|---|
duration | 秒; 0 禁用新消息的自动关闭。 | number | 3 |
pauseOnHover | 悬停时暂停计时器。 | boolean | true |
maxCount | 新的限制将在您下次添加时应用。 | number | 没有限制 |
prefixCls | MessageHolder 及其卡片的完整前缀。空字符串/undefined 继承ConfigProvider。不更改队列或计时器。 | string | ConfigProvider.prefixCls + "-message" |
top | 距视口顶部的偏移量。数值以像素为单位。 | number | string | 8 |
rtl | 设置该列表的文字方向。 | boolean | ConfigProvider.direction |
getContainer | 返回挂载列表的 DOM 元素。位置仍相对于浏览器视口。 | () => HTMLElement | null | undefined | — |
stack | 超过阈值时折叠列表。默认阈值为三条消息。 | boolean | { threshold?: number } | false |
transitionName | CSS 过渡名称。空字符串会关闭动画。 | string | — |
classNames | 各部分的 CSS 类名,接受对象或根据 props 返回对象的函数。 | MessageSemantic | — |
styles | 各部分的内联 CSS 字符串,接受对象或根据 props 返回对象的函数。 | MessageSemantic | — |
AppNotificationConfig
| 属性 | 描述 | 类型 | 默认 |
|---|---|---|---|
placement | 标本的一般位置。 | NotificationPlacement | topRight |
duration | 总持续时间。 | number | false | 4.5 |
pauseOnHover | 一般定时器暂停。 | boolean | true |
maxCount | 所有展示位置的一般限制。 | number | 没有限制 |
showProgress | 显示距离关闭的剩余时间。 | boolean | false |
prefixCls | 列表及卡片的完整 CSS 前缀。 | string | ConfigProvider.prefixCls + "-notification" |
top | 表面的顶部凹痕。 | number | 24 |
bottom | 底面压痕。 | number | 24 |
stack | 每个位置的折叠阈值。设为 false 可始终展开列表。 | boolean | { threshold?: number } | { threshold: 3 } |
rtl | 文字方向。卡片在屏幕上的位置由 placement 决定。 | boolean | ConfigProvider.direction |
getContainer | 选择浏览器中挂载通知列表的节点。 | () => HTMLElement | ShadowRoot | null | undefined | — |
closeIcon | 所有卡片共用的自定义关闭图标。 | NotificationContent | ConfigProvider.notification.closeIcon |
classNames | 此实例的列表和卡片的 CSS 类名。 | NotificationSemantic | — |
styles | 此实例的列表和卡片的样式。 | NotificationSemantic | — |
onAllRemoved | 最后一张卡片从 DOM 中移除后调用。 | () => void | — |
App.useApp() 和 useApp()
当子组件初始化时调用。 AppInstance 包含稳定的 message、notification 和模态。个人持有者已连接到该应用程序;不需要同一 API 的第二个持有者。
记录参数在页面上有描述 Message, Notification 和 Modal。 ConfigProvider.app 只接受 class/style;当地 style 优先。
Semantic DOM
默认情况下,App 创建一个带有 ant-app class、标记 ant-app-css-var 和主题排版的 div。 HTML 属性和 nativeElement 引用此根。这是实际标记的描述:classNames/styles 和命名语义槽未发布。
component=false 显示没有 root 的 children 和持有者;不应用 class/style/attrs 和 nativeElement 包装器。表面的位置及其可访问性属于 MessageHolder、NotificationHolder 和本机 Modal。该应用程序不会造成一般的焦点陷阱。
注册令牌
没有本机应用程序组件令牌。通用别名可以通过 theme.components.App 进行细化:设计示例更改了根排版,同时保留了 Button 自己的标记。没有了 component=false root,这些App样式就无处可应用;装饰外容器。
| 代币 | 当前主题值 |
|---|---|
colorText | rgba(0,0,0,0.88) |
fontSize | 14 |
lineHeight | 1.5714285714285714 |
fontFamily | -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji' |
FAQ
为什么 useApp 报告App丢失?
App下的子组件初始化时必须调用。绘制下面的应用程序的同一父级中的调用不会接收其上下文。将使用者放置在子组件中,如 Actions.svelte 源代码中所示。
App旁边是否需要MessageHolder和ModalHolder?
App 已连接所有三个支架。仅为单独创建的 createMessage/createNotification/createModal 实例添加单独的持有者。
为什么新的 maxCount 没有立即删除旧消息?
默认更改以下调用。队列随着下一次添加而缩短;打开的计时器不会重新启动。对于显式清理,请调用 message.destroy() 或 notification.destroy()。 modal没有这么通用的 destroyAll:销毁特定句柄。
为什么 component=false 改变了外观并重置了子草稿?
应用程序根目录消失了,因此它的 class/style/属性和版式别名不适用。更改模式会重新创建 children/持有者。将所需的设计设置到外部容器并将保存的模型存储在此边框上方。
该 API 可以在子处理程序之外使用吗?
当特定范围初始化时获取 API 并将其显式传递给所需的函数。不要在生命周期之外调用 useApp,也不要为不同的用户创建服务器端全局队列。