Skip to content
The module adds WP-API to your nuxt application.
Branch: master
Clone or download

README.md

wp-nuxt

npm (scoped with tag) npm CircleCI Codecov Dependencies js-standard-style FOSSA Status

📖 Release Notes

Features

The module adds WP-API to your nuxt application.

The size of the library is 49,8 kB minified (14 kB gzipped). npm bundle size

Setup

  • Add wp-nuxt dependency using yarn or npm to your project

  • Add wp-nuxt to modules section of nuxt.config.js

{
  modules: [
    // Simple usage
    'wp-nuxt',

    // With options
    ['wp-nuxt', {
      endpoint: 'https://wp.kmr.io/wp-json'
      /* other options of WP-API */
    }],
 ]
}

Usage

You can use the API of WP-API using the injected 'app.$wp'. (s. example)

Example

<script>
export default {
  async asyncData ({ app, store, params }) {
    return { articles: await app.$wp.posts().perPage(10) }
  }
}
</script>

License

MIT License

Copyright (c) yashha

FOSSA Status

You can’t perform that action at this time.