返回 slidev
iframe.vue
根目录 / packages / client / layouts / iframe.vue
1 <script setup lang="ts">
2 import { computed } from 'vue'
3
4 const props = defineProps<{
5 url: string
6 scale?: number
7 }>()
8
9 const scaleInvertPercent = computed(() => `${(1 / (props.scale || 1)) * 100}%`)
10 </script>
11
12 <template>
13 <div class="h-full w-full">
14 <div relative :style="{ width: scaleInvertPercent, height: scaleInvertPercent }">
15 <iframe
16 id="frame" class="w-full h-full"
17 :src="url"
18 :style="scale ? { transform: `scale(${scale})`, transformOrigin: 'top left' } : {}"
19 />
20 </div>
21 </div>
22 </template>
23
23 lines Plain Text