import Vue from 'vue' import Confirm from './Confirm.vue' let newInstance; const ConfirmInstance = Vue.extend(Confirm) const initInstance = () => { newInstance = new ConfirmInstance() document.body.appendChild(newInstance.$mount().$el) } export const confirm = (options) => { if (!newInstance) { initInstance() } Object.assign(newInstance, options) return newInstance.show(vm => { newInstance = null }) }