feat: show function start time
This commit is contained in:
1 parent
c338533e34
commit
6c3ed25a43
2 files changed
+9
-3
No files matched your search
@@ -1,9 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { data } = await useFetch('/api/pageview')
|
const { data } = await useFetch('/api/pageview')
|
||||||
|
|
||||||
|
const time = useTimeAgo(computed(() => data.value.startAt))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div op50>
|
<div text-gray>
|
||||||
Pageview: {{ data.pageview }}
|
<span font-500>{{ data.pageview }}</span> page views since <span font-500>{{ time }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
const startAt = Date.now()
|
||||||
let count = 0
|
let count = 0
|
||||||
|
|
||||||
export default () => ({ pageview: count++ })
|
export default () => ({
|
||||||
|
pageview: count++,
|
||||||
|
startAt,
|
||||||
|
})
|
||||||
Reference in new issue
Block a user