<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 } 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');
|
} else if (event.data.type === 'childIsReady') {
|
console.log('🚀 ~ child is ready',);
|
ChildRegister.registerNotifyFunction();
|
}
|
});
|
});
|
</script>
|
<style scoped lang="scss"></style>
|