跳过内容

@capgo/capacitor-pretty-toast

在 iOS、Android 和 Web 上使用队列、更新、操作、图标和 Promise 状态显示原生样式的提示通知。

@capgo/capacitor-pretty-toast 提供了 toast.* API for native-first toast notifications in Capacitor apps. It renders native overlays on iOS and Android and a DOM renderer on Web.

原生式的提示通知在 __CAPGO_KEEP_1__ 应用中的支持。它在 iOS 和 Android 上渲染原生覆盖层,在 Web 上渲染 DOM 渲染器。

使用它来显示成功消息、错误、加载状态、长时间运行的 Promise feedback 和需要与平台集成的操作提示。

演示demo
外部设备上的动画提示demo
Toast通知流程

核心功能

核心功能
  • toast.show - 使用完整配置对象显示自定义Toast。
  • toast.success, toast.error, toast.info, toast.warning - 使用标题和可选配置显示常见语义Toast。
  • toast.loading - 显示一个持续加载的Toast。
  • toast.update - 在原处更新一个Toast。
  • toast.promise - 跟踪一个Promise,显示加载、成功和错误状态。
  • toast.dismisstoast.dismissAll - 移除一个Toast或清空队列。
方法描述
toast.show(config, options?)使用完整__CAPGO_KEEP_0__显示提示 ToastConfig.
toast.success(title, config?, options?)显示成功提示
toast.error(title, config?, options?)显示错误提示
toast.info(title, config?, options?)显示信息提示
toast.warning(title, config?, options?)显示警告提示
toast.loading(title, config?, options?)显示不自动关闭的加载提示
toast.update(id, partial)更新现有提示
toast.promise(promise, messages)显示加载状态,然后更新为成功或错误
toast.dismiss(id?)关闭一个提示或当前提示
toast.dismissAll()关闭所有可见和排队的提示。

此参考资料是从 src/definitions.tscapacitor-pretty-toast.

从 @capgo/capacitor-pretty-toast 中继续

名为“从 @capgo/capacitor-pretty-toast 中继续”的部分

如果您正在使用 @capgo/capacitor-pretty-toast 来规划原生插件工作,连接它到 Capgo Plugin Directory 为产品工作流程在Capgo插件目录中 Capacitor插件由Capgo 为Capacitor插件由Capgo的实现细节 添加或更新插件 为添加或更新插件的实现细节 Ionic企业插件替代品 为产品工作流程在Ionic企业插件替代品中 Capgo原生构建 为产品工作流程在Capgo原生构建中