Skip to content

Commit cf493c7

Browse files
committed
cleanup nuxt demo
1 parent dd21305 commit cf493c7

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

demo/nuxt/pages/index.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script setup lang="ts">
2-
import { useNuxtApp } from "#app"
3-
42
const { $notion } = useNuxtApp()
53
const { data } = await useAsyncData("notion-index", () => $notion.getPageBlocks("4b2dc28a5df74034a943f8c8e639066a"))
64
const { mapPageUrl, pageLinkOptions } = useProps()

demo/nuxt/pages/page/[id].vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<script setup lang="ts">
2-
import { useNuxtApp } from "#app"
3-
42
const route = useRoute()
53
const { $notion } = useNuxtApp()
6-
const { data } = await useAsyncData(`notion-${route.params.id}`, () => $notion.getPageBlocks(route.params.id))
4+
const { data, pending } = useLazyAsyncData(`notion-${route.params.id}`, () =>
5+
$notion.getPageBlocks(route.params.id.toString())
6+
)
77
const { mapPageUrl, pageLinkOptions } = useProps()
88
</script>
99

1010
<template>
11-
<div>
11+
<div v-if="pending" class="notion">Loading...</div>
12+
<div v-else>
1213
<NotionRenderer :blockMap="data" fullPage prism katex :mapPageUrl="mapPageUrl" :pageLinkOptions="pageLinkOptions" />
1314
</div>
1415
</template>

0 commit comments

Comments
 (0)