7.1.0 • Published 3 years ago
faker-nuxt v7.1.0
faker-nuxt
Features
- Inject
$fakerto the context everywhere.
Setup
- Add
faker-nuxtdependency to your project
npm install --save-dev faker-nuxt # or yarn add --dev faker-nuxt- Add
faker-nuxtto thebuildModulessection ofnuxt.config.js
export default {
buildModules: [
// Simple usage
'faker-nuxt',
// With options
['faker-nuxt', { /* module options */ }]
]
}:warning: 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>7.1.0
3 years ago
6.0.0-alpha.5
4 years ago
6.0.0-alpha.6
4 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago