Usage 3.0.0-alpha
🤔 Something feels wrong with the plugin's usage? Let us know in the ongoing Vue 3 Kit RFC!
@prismicio/vue plugin's interface is made available inside your application through different ways.
To know exposed methods and properties check the references section.
To learn more about querying and templating check their related documentation:
Options API
When using the Options API (same as with Vue.js 2), plugin's interface is made available through the $prismic object inside Vue.js context:
src/views/index.vue
export default {
async created() {
const document = await this.$prismic.client.getByUID("page", "home");
}
/* ... */
};
Composition API
When using the Composition API (new with Vue.js 3), @prismicio/vue exposes a usePrismic hook that returns you the plugin's interface:
src/views/index.vue
import { usePrismic } from "@prismicio/vue";
export default {
async setup() {
const prismic = usePrismic();
const document = await prismic.client.getByUID("page", "home");
}
/* ... */
};
Edit this page on GitHub
Updated at Thu, Aug 12, 2021