Skip to content

Commit

Permalink
feat: support scale for iframe layout
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Aug 30, 2022
1 parent 5460af5 commit fcdd4da
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions packages/client/layouts/iframe.vue
@@ -1,11 +1,23 @@
<script setup lang="ts">
defineProps<{ url: string }>()
import { computed } from '@vue/reactivity'
const props = defineProps<{
url: string
scale?: number
}>()
const scaleInvertPercent = computed(() => `${(1 / (props.scale || 1)) * 100}%`)
</script>

<template>
<div class="h-full w-full">
<div class="w-full h-full">
<iframe id="frame" class="w-full h-full" :src="url" />
<div relative :style="{ width: scaleInvertPercent, height: scaleInvertPercent }">
<iframe
id="frame" class="w-full h-full"
:src="url"
:style="scale ? { transform: `scale(${scale})`, transformOrigin: 'top left' } : {}"
/>
</div>
</div>
</template>

0 comments on commit fcdd4da

Please sign in to comment.