References 3.0.0-alpha
🤔 Something feels wrong with the reference? Let us know in the ongoing Vue 3 Kit RFC!
Configuration
This is the shape of the object that the createPrismic
function expects you to provide. Only the endpoint
option is mandatory.
interface PrismicPluginOptions {
endpoint: string;
apiOptions?: ApiOptions;
linkResolver?: LinkResolver;
htmlSerializer?: HtmlSerializer<string>;
client?: boolean | ClientOptions;
dom?: boolean | DOMOptions;
components?: boolean | ComponentsOptions;
}
const prismic = createPrismic({
endpoint: "",
apiOptions: {},
linkResolver: () => "/",
htmlSerializer: () => null,
client: {},
dom: {},
components: {},
});
Key | Type | Required | Default | Description |
---|---|---|---|---|
endpoint | string | Yes | Your Prismic repository API endpoint | |
apiOptions | ApiOptions | No | {} | Additional options sent to Prismic API when initing the client, see Prismic documentation. |
linkResolver | LinkResolver | No | () => "/" | A custom link resolver function to use |
htmlSerializer | HtmlSerializer<string> | No | () => null (rely on default serialization for everything) | A custom HTML serializer function to use |
client | ClientOptions | No | {} (same as true , activated) | More information on the Client kit page |
dom | DOMOptions | No | {} (same as true , activated) | More information on the DOM kit page |
components | ComponentsOptions | No | {} (same as true , activated) | More information on the Components kit page |
Exposed Interface
Core
These methods and properties are always available on the exposed interface:
Methods or properties | Type | Description |
---|---|---|
endpoint | string | Provided API endpoint |
apiOptions | ApiOptions | Provided API options or the default ones |
linkResolver() | LinkResolver | Provided link resolver or the default one |
htmlSerializer() | HtmlSerializer<string> | Provided HTML Serializer or the default one |
Kits
Kits may expose additional methods or properties when activated. Here's an overview of them:
Kit | Exposed methods and properties | More information |
---|---|---|
Client | client , previewCookie , Predicates | Client kit page |
DOM | asHtml() , asText() , asLink() , asDate() | DOM kit page |
Components | Components kit page |
Kits exposed methods and properties aren't nested. Access them directly at the root of the Prismic object.
e.g. this.$prismic.client
or const { client } = usePrismic()
Edit this page on GitHub
Updated at Thu, Aug 12, 2021