diff --git a/src/components/imgModal/imgModal.js b/src/components/imgModal/imgModal.js new file mode 100644 index 0000000..825bccb --- /dev/null +++ b/src/components/imgModal/imgModal.js @@ -0,0 +1,19 @@ +import { createApp } from 'vue'; +import imgModalPopup from '@/components/imgModal/index.vue' + +export default function useImgModalPopup() { + function showImgModal(obj) { + const instance = createApp(imgModalPopup,{ + //监听消息关闭事件 + onClose:()=>{ + instance.unmount(); + document.body.removeChild(mountNode); + } + }); + const mountNode = document.createElement('div'); + document.body.appendChild(mountNode); + const vm = instance.mount(mountNode); + vm.showImgModal(obj) + } + return { showImgModal }; +} diff --git a/src/components/imgModal/index.vue b/src/components/imgModal/index.vue index 7adbf0f..801a0c2 100644 --- a/src/components/imgModal/index.vue +++ b/src/components/imgModal/index.vue @@ -5,34 +5,31 @@
- -
关闭
+
+ +
+
关闭