Zum Inhalt springen

Getting Started

GitHub

Sie können unser AI-gestütztes Setup verwenden, um das Plugin zu installieren. Fügen Sie den Capgo-Fähigkeiten Ihrer AI-Werkzeug mit der folgenden Befehl hinzu:

Terminal-Fenster
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

Verwenden Sie dann die folgende Anleitung:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-pretty-toast` plugin in my project.

Wenn Sie die manuelle Einrichtung bevorzugen, installieren Sie das Plugin, indem Sie die folgenden Befehle ausführen und die darunterstehenden plattform-spezifischen Anweisungen befolgen.

Terminalfenster
npm install @capgo/capacitor-pretty-toast
npx cap sync
import { toast } from '@capgo/capacitor-pretty-toast';
import { toast } from '@capgo/capacitor-pretty-toast';
toast.success('Saved', { message: 'Draft synced.' });
  • Ids laden: Ids beibehalten, wenn man aufruft toast.update().
  • Debouncing: Fehler sollten sich schnell zu einem Toast zusammenfassen.
  • Marken: Icons und Farben pro Plattform anpassen.
toast.success('Saved', {
message: 'Your changes are ready.',
});
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);

Einen Promise verfolgen

Abschnitt: Einen Promise verfolgen
await toast.promise(uploadFile(), {
loading: {
title: 'Uploading',
message: 'Keep the app open while the file is sent.',
},
success: 'Uploaded',
error: 'Upload failed',
});

Verwenden icon für einen Symbolnamen oder Roh-SVG-Markup:

toast.info('New message', {
icon: 'message.fill',
message: 'Open the inbox to reply.',
});

Verwenden iconSource für URI-artige Bilder. Es unterstützt https://, http://, file://, data:, blob:, absolute Dateipfade oder { uri }.

toast.show({
title: 'Profile updated',
message: 'Your avatar changed.',
iconSource: 'https://example.com/avatar.png',
});

iconSource hat Vorrang vor icon.

Fortfahren von Getting Started

Sektion: Fortfahren von Getting Started

Wenn Sie Capgo verwenden __CAPGO_KEEP_0__ Plugin-Verzeichnis um native Plugin-Arbeit zu planen, verbinden Sie es mit Capgo Plugins von __CAPGO_KEEP_1__ für die Implementierungsdetails für den Produktworkflow in der Capgo Plugin-Datenbank Capacitor Plugins von Capgo Capacitor Plugins von Capgo für die Implementierungsdetails in Capacitor Plugins von Capgo Hinzufügen oder Aktualisieren von Plugins für die Implementierungsdetails in Hinzufügen oder Aktualisieren von Plugins, Ionic Enterprise Plugin Alternativen für den Produktworkflow in Ionic Enterprise Plugin Alternativen und Capgo nativee native Builds für den Produktworkflow in Capgo Native Builds.