Langsung ke konten

Panduan Memulai

GitHub

Anda bisa menggunakan AI-Assisted Setup kami untuk menginstal plugin ini. Tambahkan skill Capgo ke tool AI Anda dengan command berikut:

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

Lalu gunakan prompt berikut:

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

Jika Anda lebih memilih Manual Setup, instal plugin dengan menjalankan perintah berikut dan ikuti petunjuk khusus platform di bawah ini:

Jendela terminal
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.' });
  • Memuat ID: pertahankan ID saat memanggil toast.update().
  • Debouncing: error beruntun harus digabung jadi satu toast.
  • Branding: sesuaikan ikon dan warna tiap platform.
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);
await toast.promise(uploadFile(), {
loading: {
title: 'Uploading',
message: 'Keep the app open while the file is sent.',
},
success: 'Uploaded',
error: 'Upload failed',
});

Gunakan icon untuk nama simbol atau markup SVG mentah:

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

Gunakan iconSource untuk gambar seperti URI. Mendukung https://, http://, file://, data:, blob:, path file absolut, atau { uri }.

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

iconSource memiliki prioritas lebih tinggi daripada icon.

Jika Anda menggunakan Panduan Memulai untuk merencanakan pekerjaan plugin native, hubungkan dengan Direktori Plugin Capgo untuk alur kerja produk di Direktori Plugin Capgo, Plugin Capacitor oleh Capgo untuk detail implementasi pada Capacitor Plugins oleh Capgo Menambahkan atau Memperbarui Plugin untuk detail implementasi pada Menambahkan atau Memperbarui Plugin, Alternatif Plugin Ionic Enterprise untuk alur kerja produk di alternatif plugin Ionic Enterprise, dan Capgo Native Build untuk alur kerja produk di Capgo Native Builds.