开始
复制一个设置提示,包含安装步骤和该插件的完整 Markdown 指南。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-pretty-toast`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/pretty-toast/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
安装
标题为“安装”npm install @capgo/capacitor-pretty-toastnpx cap syncimport { toast } from '@capgo/capacitor-pretty-toast';显示 Toast
Section titled “显示 Toast”toast.success('Saved', { message: 'Your changes are ready.',});更新加载中 Toast
Section titled “更新加载中 Toast”const id = toast.loading('Uploading', { message: 'Waiting for the server response.',});
setTimeout(() => { toast.update(id, { title: 'Upload complete', message: 'The file was stored successfully.', icon: 'checkmark.circle.fill', autoDismiss: true, });}, 1500);跟踪 Promise
Section titled “跟踪 Promise”await toast.promise(uploadFile(), { loading: { title: 'Uploading', message: 'Keep the app open while the file is sent.', }, success: 'Uploaded', error: 'Upload failed',});图标和图片
图标和图片用来 icon 为符号名称或原始 SVG 标记:
toast.info('New message', { icon: 'message.fill', message: 'Open the inbox to reply.',});用来 iconSource URI 类型的图片。它支持 https://, http://, file://, data:, blob:,绝对文件路径,或 { uri }.
toast.show({ title: 'Profile updated', message: 'Your avatar changed.', iconSource: 'https://example.com/avatar.png',});iconSource 优先于 icon.
继续从 Getting Started
继续从 Getting Started如果您正在使用 开始使用 为了native插件的工作,连接它与 Capgo 插件目录 在Capgo 插件目录中, Capacitor 插件由Capgo 在Capacitor 插件由Capgo中, 添加或更新插件 在添加或更新插件中, Ionic企业版插件替代品 在Ionic企业版插件替代品中, Capgo 本地构建 在Capgo 本地构建中,