$prismic Object

Easily connect your Nuxt.js application to your content hosted on Prismic

This module globally injects a $prismic object, meaning that you can access it anywhere using this.$prismic. For plugins, asyncData, nuxtServerInit and middlewares, you can access it from context.$prismic.

Methods

asHTML(richText)

Similar to PrismicDOM.RichText.asHTML, except that you don't have to pass through linkResolver and htmlResolver functions, the ones you provided are injected.

  • richText
    • Type: Object (Prismic Rich Text field object)
    • required

asText(richText)

Similar to PrismicDOM.RichText.asText.

  • richText
    • Type: Object (Prismic Rich Text field object)
    • required

Similar to PrismicDOM.Link.url, except that you don't have to pass through a linkResolver function, the one you provided is injected.

  • link
    • Type: Object (Prismic Link field object)
    • required

asDate(date)

Similar to PrismicDOM.Date.

  • date
    • Type: String (Prismic Date field string)
    • required

linkResolver(doc)

This is the linkResolver function you provided to the module. See configuration.

More on link resolving on Prismic documentation.

htmlSerializer(type, element, content, children)

This is the htmlSerializer function you provided to the module. See configuration.

More on the HTML Serializer on Prismic documentation.

preview()

This method resolves a preview session. You might be interested to use it if you provide a custom preview page.

This method is only available when previews are enabled.

Properties

api

Contains current instance of the Prismic API, see fetching content examples or learn more on how to query the API on Prismic documentation.

predicate

Contains all Prismic predicates coming from @prismicio/client kit, see complete predicate reference on Prismic documentation.

dom

Gives your direct access to the prismic-dom library.

Edit this page on GitHub Updated at Tue, Aug 1, 2023