onClose, onClick, and onMounted hooksuseToast from within a component.useToast().position option.toast, it won't work when registering the plugin with app.use.timeout option or disable it altogether by setting it to falsetoastId containing the toast ID is always passed by default. Also, an event listener for close-toast is attached, so you can close the toast programmatically by emitting it from inside the component.
close-toast eventRouterLink, NuxtLink, etcshareAppContext to true during registration.$toast.update(id, { content, options }, create) with content, options and create being optional. Updates override previous values.create is a boolean, false by default. If true, a toast will be created if no matching toast with the id is found.clear.divs that contain the toasts in the 6 possible toast positions (top-right, top-left, etc).Vue-Toastification__bounce-enter-active, Vue-Toastification__bounce-leave-active and Vue-Toastification__bounce-move.fade and bounce transitions:icon: false when either registering the plugin or creating toasts. Without the icon, the toast's content will fill its place and appear closer to the edge.icon option. To do so, you'll probably need to install these icons in your app with an icon library, such as FontAwesome or Material Icons.icon: "my-icon-class", pass a custom component / JSX, or you can set up more complex icon systems by passing an object. Let's look at the options with some examples:fas fa-rocket, the rendered component will look like:iconClass, iconChildren and iconTag.Vue-Toastification__icon. You can see what it does here or you can override it with your CSS classes.closeButton to false when calling the toast or setting up the pluginshowCloseButtonOnHover to true when calling the toast or setting up the plugintransition, maxToasts and others. If you need to update those options in runtime, there is a method you can call to update the default options:updateDefaults to update any of the default API options, but be careful as they are updated globally, so all new toasts will share the new defaults.filterBeforeCreate and filterToasts.filterBeforeCreate allows you to edit toast props in runtime or discard toasts entirely.false to discard the toast.filterBeforeCreate by allowing you to enqueue toasts, as opposed to the former, which allows you to discard them.preventDuplicates feature that enqueues toasts instead of discarding them:div that is a direct child of document.body, but your application may require that toasts be mounted elsewhere for whatever reason. Vue Toastification allows you to do that by accepting a container plugin option. That option may be either an HTMLElement or a function that returns or resolves into an HTMLElement.toast-container:toast will still be executed successfully and the toasts will be displayed all at once when it is mounted.createToastInterface:myInterface.success(), etc), will trigger toasts to appear inside the new container.createToastInterface and get an interface to the existing instance, without creating a new one.useToast:this.$toast is not available anymore. Use useToast to get a toast interface. The returning object is identical and has the same methods as this.$toast.transitionDuration has been deprecated. To change the duration of a transition, change or override the transition classes.Posted Sep 29, 2023
Vue notifications made easy! Contribute to Maronato/vue-toastification development by creating an account on GitHub.
0
50