wujingjing
2025-03-31 a22a715caae95546e40358a5327487f5f46fe749
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<template>
    <div class="bg-white">
        <iframe ref="iframeRef" :src="url" class="w-full h-full border-none overflow-hidden"></iframe>
    </div>
</template>
 
<script setup lang="ts" name="CustomerService">
const emit = defineEmits(['close']);
 
import { ref, onMounted } from 'vue';
import { ChildRegister, setParentFunction } from '@/utils/iframeCall';
const getUrl = () => {
    const isDev = import.meta.env.DEV;
    if (isDev) {
        return 'http://localhost:5679';
    }
    return 'http://www.xpump.net/iie-mobile?v=132323';
};
 
const url = getUrl();
 
const iframeRef = ref<HTMLIFrameElement>();
 
onMounted(() => {
    window.addEventListener('message', (event) => {
        if (event.data.type === 'close') {
            emit('close');
        }
    });
    setTimeout(() => {
        ChildRegister.registerNotifyFunction();
    }, 800);
});
</script>
<style scoped lang="scss"></style>