UNPKG

msf-ui

Version:
27 lines (26 loc) 651 B
import alert from './index.vue' export default { install: function (Vue, options) { var instance Vue.prototype.$alert = function (opts, fn) { if (instance) { instance.$el.remove() } var Alert = Vue.extend(alert) instance = new Alert({ el: document.createElement('div') }) try { opts = Object.assign({}, opts, options) } catch (e) { } for (var key in opts) { instance[key] = opts[key] } typeof fn === 'function' && instance.$on('submit', fn) document.body.appendChild(instance.$el) instance.open() return instance } } }