import loginModelVue from './index.vue'; const loginModel = {}; loginModel.install = function(Vue, options) { const loginModelInstance = Vue.extend(loginModelVue); let currentModel; const initInstance = () => { currentModel = new loginModelInstance(); let msgBoxEl = currentModel.$mount().$el; document.body.appendChild(msgBoxEl); }; Vue.prototype.$authologin = { show(options) { if (!currentModel) { initInstance(); } if (typeof options === 'string') { currentModel.content = options; } else if (typeof options === 'object') { Object.assign(currentModel, options); } return currentModel; }, hide(){ currentModel.show=false } }; }; export default loginModel;