-
Notifications
You must be signed in to change notification settings - Fork 14
/
sfc.vue
41 lines (36 loc) · 869 Bytes
/
sfc.vue
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
<script setup>
import { inject } from 'vue'
const props = defineProps({
example: {
type: String,
required: true,
},
})
/**
* @type { Record<string, Record<string, string>> }
*/
const examples = inject('repl-content', {})
const content = examples[props.example]
const encoded =
typeof window !== 'undefined' &&
content &&
window.btoa(JSON.stringify(content))
// console.log(encoded)
</script>
<template>
<div class="slidev-layout default">
<div class="grid justify-items-stretch items-center w-full h-full">
<slot />
<div class="overflow-hidden text-center self-end">
<iframe
v-if="encoded"
:src="`https://sfc.vuejs.org/#${encoded}`"
frameborder="0"
width="960"
height="460"
class="-mt-14 mb-2"
></iframe>
</div>
</div>
</div>
</template>