UNPKG

york-demo-ui

Version:
28 lines (24 loc) 571 B
import Alert from './Alert.vue' export default { install (Vue) { let alertConstrutor = Vue.extend(Alert) let instance Alert.getInstance = () => { instance = instance || new alertConstrutor() let el = instance.$mount().$el document.body.appendChild(el) return { add (notification) { instance.add(notification) }, remove (name) { instance.remove(name) } } } Vue.prototype.$alert = (props = {}) => { Alert.getInstance() instance.add(props) } } }