1
1
<script setup>
2
- import { computed , definePageMeta , onBeforeUnmount , onMounted , ref , useDebounceFn , useServerSeoMeta , watch } from ' #imports'
2
+ import { computed , definePageMeta , useServerSeoMeta } from ' #imports'
3
3
4
4
definePageMeta ({
5
5
title: ' Home' ,
@@ -8,57 +8,16 @@ definePageMeta({
8
8
})
9
9
10
10
useServerSeoMeta ({
11
- title: ' Home & //<"With Encoding"> \\\\ ' ,
12
- ogTitle: ' Home & //<"With Encoding"> \\\\ ' ,
11
+ title: ' Welcome to the playground ' ,
12
+ ogTitle: ' Welcome to the playground ' ,
13
13
})
14
14
15
15
const host = computed (() => typeof window !== ' undefined' ? window .location .href : ' /' )
16
-
17
- const color = ref (' bg-green-500' )
18
- const title = ref (' Fully dynamic' )
19
-
20
- const time = ref (' ' )
21
-
22
- function setTime () {
23
- const date = new Date ()
24
- const hours = date .getHours ()
25
- const minutes = date .getMinutes ()
26
- const seconds = date .getSeconds ()
27
- // use am pm
28
- const ampm = hours >= 12 ? ' PM' : ' AM'
29
- const hours12 = hours % 12 || 12
30
- time .value = ` ${ hours12} :${ minutes < 10 ? ` 0${ minutes} ` : minutes} :${ seconds < 10 ? ` 0${ seconds} ` : seconds} ${ ampm} `
31
- }
32
-
33
- setTime ()
34
-
35
- let interval = null
36
- onMounted (() => {
37
- interval = setInterval (() => {
38
- setTime ()
39
- }, 15000 )
40
- })
41
-
42
- onBeforeUnmount (() => {
43
- clearInterval (interval)
44
- })
45
-
46
- const tailwindUrl = ref (` ${ host .value } satori/tailwind/__og_image__/og.png?title=${ encodeURIComponent (title .value )} &bgColor=${ color .value .replace (' #' , ' ' )} ` )
47
-
48
- const setTailwindUrl = useDebounceFn (() => {
49
- // do something
50
- tailwindUrl .value = ` ${ host .value } satori/tailwind/__og_image__/og.png?title=${ encodeURIComponent (title .value )} &bgColor=${ color .value .replace (' #' , ' ' )} `
51
- }, 500 )
52
-
53
- watch ([color, title], () => {
54
- // do debounce
55
- setTailwindUrl ()
56
- })
57
16
</script >
58
17
59
18
<template >
60
19
<div class =" px-7 my-5" >
61
- <OgImage description =" My description of the home page." theme-color = " #b5ffd6 " />
62
- <img :src =" `${host}satori/static/__og_image__ /og.png`" width =" 400" height =" 210" class =" rounded" >
20
+ <OgImage description =" My description of the home page." />
21
+ <img :src =" `${host}__og-image__/image/ satori/static/og.png`" width =" 400" height =" 210" class =" rounded" >
63
22
</div >
64
23
</template >
0 commit comments