UNPKG

drip-ui

Version:

Lightweight Mobile UI Components built on Vue

33 lines (29 loc) 680 B
import dripnNtify from './Notify' import Vue from 'vue' export default function plugin() { if (plugin.installed) { return } let Component, component Component = Vue.extend(dripnNtify) component = new Component({ el: document.createElement('div') }) // success info warning error function method({ content, type = 'error', duration = 3000 }) { document.body.appendChild(component.$el) component.content = content component.type = type component.visible = true setTimeout(item => { component.visible = false component.content = '' }, duration) } Vue.notify = method Vue.prototype.$notify = method }