drip-ui
Version:
Lightweight Mobile UI Components built on Vue
41 lines (33 loc) • 1.12 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = plugin;
var _Notify = _interopRequireDefault(require("./Notify"));
var _vue = _interopRequireDefault(require("vue"));
function plugin() {
if (plugin.installed) {
return;
}
var Component, component;
Component = _vue["default"].extend(_Notify["default"]);
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["default"].notify = method;
_vue["default"].prototype.$notify = method;
}