Some checks are pending
Check / lint (push) Waiting to run
Check / typecheck (push) Waiting to run
Check / build (build, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build, 18.x, windows-latest) (push) Waiting to run
Check / build (build:app, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:app, 18.x, windows-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, windows-latest) (push) Waiting to run
20 lines
576 B
JavaScript
20 lines
576 B
JavaScript
import { createApp } from 'vue';
|
|
import MessagePopup from '@/components/x-message/index.vue'
|
|
|
|
export default function useMessagePopup() {
|
|
function showMessage(obj) {
|
|
const messageInstance = createApp(MessagePopup,{
|
|
//监听消息关闭事件
|
|
onAfterLeave:()=>{
|
|
messageInstance.unmount();
|
|
document.body.removeChild(mountNode);
|
|
}
|
|
});
|
|
const mountNode = document.createElement('div');
|
|
document.body.appendChild(mountNode);
|
|
const vm = messageInstance.mount(mountNode);
|
|
vm.showMessage(obj)
|
|
}
|
|
return { showMessage };
|
|
}
|