UNPKG

drip-ui

Version:

Lightweight Mobile UI Components built on Vue

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