-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Description
Currently this is my plugin file:
import VueNotion, { getPageBlocks, getPageTable } from "vue-notion";
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(VueNotion);
return {
provide: {
notion: { getPageBlocks, getPageTable },
},
}
})
and component file:
<template>
<NotionRenderer :blockMap="blockMap" fullPage />
</template>
<script setup>
const { $notion } = useNuxtApp()
const props = defineProps({
projectUrl: {
type: String,
required: true
}
})
const { data: blockMap } = useAsyncData('page_nuxt', () => $notion.getPageBlocks(props.projectUrl))
watch(
() => props.projectUrl,
async (projectUrl) => {
const { data: blockMap } = useAsyncData('page_nuxt', () => $notion.getPageBlocks(projectUrl))
}
)
</script>
<style>
@import 'vue-notion/src/styles.css';
</style>
This works however I'm struggling to make the renderer work without using composition API? Can someone hint me please?
I tried to do something like this, based on the example but get no output:
<template>
<NotionRenderer :blockMap="blockMap" fullPage />
</template>
<script>
import { useNuxtApp } from '@nuxt/app';
export default {
data() {
return {
blockMap: null,
};
},
async created() {
const { $notion } = useNuxtApp();
const { data } = await this.$notion.getPageBlocks("8c1ab01960b049f6a282dda64a94afc7");
this.blockMap = data;
},
};
</script>
<style>
@import "vue-notion/src/styles.css";
</style>
Thanks
Metadata
Metadata
Assignees
Labels
No labels