Skip to content

Commit

Permalink
use lazyasyncdata for postmeta component
Browse files Browse the repository at this point in the history
  • Loading branch information
probablyjassin committed Nov 25, 2024
1 parent 8bdd4c4 commit 6434911
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion components/PostMeta.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@
</template>

<script setup lang="ts">
const { page } = useContent()
const route = useRoute()
const { data: page } = await useLazyAsyncData(`content-${route.path}`, () => {
return queryContent()
.where({ _path: route.path })
.only(['body', 'date'])
.findOne()
})
const wordCount = computed(() => {
if (!page.value?.body) return 0
const content = JSON.stringify(page.value.body)
Expand Down

0 comments on commit 6434911

Please sign in to comment.