wangzhibo
2026-07-16 b57020623cf0c946706573bf102e548c3a544423
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<template>
    <div v-loading="loading" class="page-iframe" :element-loading-text="$t('拼命加载中')">
        <iframe :ref="setRefs('iframe')" :src="url" frameborder="0"></iframe>
    </div>
</template>
 
<script lang="ts" setup>
defineOptions({
    name: 'frame-web'
});
 
import { ref, watch, onMounted } from 'vue';
import { useCool } from '/@/cool';
 
const loading = ref(false);
const url = ref();
 
const { route, refs, setRefs } = useCool();
 
watch(
    () => route,
    val => {
        url.value = val.meta?.iframeUrl;
    },
    {
        immediate: true,
        deep: true
    }
);
 
onMounted(() => {
    loading.value = true;
 
    refs.iframe.onload = () => {
        loading.value = false;
    };
});
</script>
 
<style lang="scss" scoped>
.page-iframe {
    height: 100%;
 
    iframe {
        height: 100%;
        width: 100%;
    }
}
</style>