xiaoluoboding / vue-sonner

🔔 An opinionated toast component for Vue.
https://vue-sonner.vercel.app
MIT License
803 stars 41 forks source link

feat: multiple action support #67

Open anwarulislam opened 4 months ago

anwarulislam commented 4 months ago

This PR adds support for multiple actions.

Example:

 toast.message('Event has been created', {
  action: [
    {
      label: 'Cancel',
      onClick: (e, toast) => toast.deleteToast(200)
    },
    {
      label: 'Confirm',
      onClick: () => console.log('Confirm')
    }
  ],
  duration: 10000000
})

Added new callback parameter in onClick function which through we can now pass the deleteToast function. And call it if it's needed. The function accepts delay as parameter to delete the toast.

vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
vue-sonner ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2024 10:36pm
anwarulislam commented 3 months ago

@xiaoluoboding any thought about this?

Cannonb4ll commented 3 months ago

This would be a very welcoming addition! 🙌