Default usage

To start using component you need simply register it. Notification instance become available inside vue instances and ready to use.


    
    import Vue from "vue"
    import CripNotice from "crip-vue-notice"

    Vue.use(CripNotice)

    Vue.extend({
      methods: {
        normal() {
          this.notice = new CripNotice({
            title: "Normal notice",
            description:
              "This notification has a class 'open-normal' and duration " +
              "in 20 seconds. So you can use button close to discard it.",
            className: "open-normal",
            duration: 20,
          })
        },

        close() {
          if (this.notice !== null) this.notice.close()
        },

        error() {
          this.$notice.error({
            title: "Error notice",
            description: "Some error description goes here",
          })
        },

        info() {
          this.$notice.info({
            title: "Informational notice",
            description: "This notification has no close button",
            closable: false,
          })
        },

        success() {
          this.$notice.success({
            title: "Success notice",
            description: "When this notice will be closed, in console will appear record",
            onClose() {
              // tslint:disable-next-line:no-console
              console.log("Success notice now is closed")
            },
          })
        },

        warning() {
          this.$notice.warning({
            title: "Warning notice",
            description: "This notice should be 500px wide",
            styles: { width: "500px", marginLeft: "-175px" },
          })
        },
      }
    })