Skip to content

Notify ​

This module act like v-snackbar vuetify component. Is a wrapper which allows you to customise the notification in the project

Configuration ​

For each style you can define icon, color and timeout

js
export default {
  we: {
    notify: {
      success: {
        icon: 'mdi-check-circle',
        color: 'success',
        timeout: 2000,
      },
      warning: {
        icon: 'mdi:exclamation',
        color: 'warning',
        timeout: 5000,
      },
      error: {
        icon: 'mdi:alert',
        color: 'error',
        timeout: 5000,
      },
      info: {
        icon: 'mdi:information',
      },
    }
  }
}

Setup ​

Add the we-notify in your layouts

TIP

You can use all the props of the v-snackbar vuetify component to customise the notify component

html
<we-notify bottom text></we-notify>

Usage ​

In your vue pages and components you can use the $notify object to show a notify

js
this.$notify.success("Hello, I'm a snackbar");
// or
this.$notify.error("oops");
// or
this.$notify.warn(
  "The given data was invalid.",
  "Email must be a valid email address"
);

// advanced usage
this.$notify.success("Title!", "Some text", {
  timeout: 3000,
  color: 'secondary',
  icon: 'md-check-circle',
});

Allowed styles are info, warn, success and error.

Options ​

Here are all the options listed for the object

NameTypeDefaultDescription
titleString
Title of the notification
textString
Text of the notification
options.timeoutnumber
3000
Override the timeout of the notification
options.colorString
Override the color of the notification
options.iconString
override the icon of the notification
options.dismissIconString
$close
dismiss icon

Custom we-notify component ​

If you need to customise the we-notify component, you can create your own component and use it instead of the default one.

You can find our component here