123
This commit is contained in:
parent
a3b191aa46
commit
2d68d041fb
19
src/components/imgModal/imgModal.js
Normal file
19
src/components/imgModal/imgModal.js
Normal file
@ -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 };
|
||||
}
|
@ -5,34 +5,31 @@
|
||||
<img class="w-525px h-87px" src="@/assets/image/cddfdf.png" alt="">
|
||||
</div>
|
||||
<div class="bg-[url('@/assets/image/zu3327@2x.png')] w-1173px h-1489px bg-cover mt-90px flex flex-col items-center pt-75px">
|
||||
<img src="@/assets/image/sdfasdfx.png" class="w-1030px h-1210px" alt="">
|
||||
<div class="bg-[url('@/assets/image/z3255@2x.png')] w-600px h-98px bg-cover text-#fff text-40px flex justify-center items-center mt-48px">关闭</div>
|
||||
<div class="w-1030px h-1020px flex flex-col items-center">
|
||||
<img :src="imgUrl" alt="" class="max-w-1030px max-h-1020px">
|
||||
</div>
|
||||
<div class="bg-[url('@/assets/image/z3255@2x.png')] w-600px h-98px bg-cover text-#fff text-40px flex justify-center items-center mt-48px" @click="closeModal">关闭</div>
|
||||
</div>
|
||||
</div>
|
||||
</teleport>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, defineEmits ,watch} from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
|
||||
const show = ref(props.modelValue);
|
||||
|
||||
watch(() => props.modelValue, (newVal) => {
|
||||
show.value = newVal;
|
||||
import { ref,defineEmits} from 'vue';
|
||||
const show=ref(false)
|
||||
const imgUrl=ref('')
|
||||
const emit = defineEmits(['close']);
|
||||
const closeModal=()=>{
|
||||
show.value=false
|
||||
emit('close')
|
||||
}
|
||||
const showImgModal=({url})=>{
|
||||
imgUrl.value=url
|
||||
show.value=true
|
||||
}
|
||||
defineExpose({
|
||||
showImgModal
|
||||
});
|
||||
|
||||
const handleClose = () => {
|
||||
emit('update:modelValue', false);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
@ -4,14 +4,16 @@ import {useAuth} from "@/store/auth/index.js";
|
||||
const {detailData} =useAuth()
|
||||
import "vant/es/image-preview/style";
|
||||
import { showImagePreview } from 'vant';
|
||||
import imgModal from '@/components/imgModal/index.vue'
|
||||
import useImgModalPopup from "@/components/imgModal/imgModal.js";
|
||||
const {showImgModal}= useImgModalPopup()
|
||||
const openMask=(src)=>{
|
||||
showImagePreview({
|
||||
showImgModal({url:src})
|
||||
/* showImagePreview({
|
||||
images:[src],
|
||||
closeable: true,
|
||||
})
|
||||
})*/
|
||||
}
|
||||
const showModal=ref(true)
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<div class="box-border relative w-[1920px] h-screen bg-no-repeat bg-cover bg-[url('@/assets/image/gdz53@2x.png')] flex items-center flex-col">
|
||||
@ -73,7 +75,5 @@ const showModal=ref(true)
|
||||
<div>
|
||||
<img class="w-1170px h-557px fixed bottom-0 right-0" src="@/assets/image/gdz54@2x.png" alt="">
|
||||
</div>
|
||||
<imgModal v-model:modelValue="showModal">
|
||||
</imgModal>
|
||||
</div>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue
Block a user