Skip to content

SkyaTura/faker-nuxt

Repository files navigation

faker-nuxt

Faker wrapper for Nuxt.js

version npm (scoped) Libraries.io dependency status for latest release node-current (scoped) Snyk Vulnerabilities for npm package gitmoji

Features

  • Inject $faker to the context everywhere.

Setup

  1. Add faker-nuxt dependency to your project
npm install --save-dev faker-nuxt # or yarn add --dev faker-nuxt
  1. Add faker-nuxt to the buildModules section of nuxt.config.js
export default {
  buildModules: [
    // Simple usage
    'faker-nuxt',

    // With options
    ['faker-nuxt', { /* module options */ }]
  ]
}

⚠️ If you are using Nuxt < v2.9 you have to install the module as a dependency (No --dev or --save-dev flags) and use modules section in nuxt.config.js instead of buildModules.

Using top level options

export default {
  buildModules: [
    'faker-nuxt'
  ],
  faker: {
    /* module options */
  }
}

Configuration

Set default locale

You can set a default locale via the locale option.

export default {
  buildModules: [
    'faker-nuxt'
  ],
  faker: {
    locale: 'pt_BR',
  }
}

Set default seed

You can set a default seed via the seed option.

export default {
  buildModules: [
    'faker-nuxt'
  ],
  faker: {
    seed: 'Banana123',
  }
}

Usage

Using inside templates

<div>{{ $faker.lorem.word() }}</div>
<div v-text="$faker.lorem.words()"></div>

Using inside scripts

<script>
  export default {
    data() {
      return {
        name: this.$faker.fake('{{name.lastName}}, {{name.firstName}} {{name.suffix}}')
      }
    }
  }
</script>

About

Faker wrapper for Nuxt.js

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy