10
<template>
  <div 
    v-editable="blok" 
    class="util__flex">
    <component 
      v-for="blok in blok.columns" 
      :key="blok._uid" 
      :blok="blok" 
      :is="blok.component"/>
  </div>
</template>

<script>
export default {
  props: ['blok']
}
</script>

Im doing tutorial at Storyblok, and I do get such an error.

https://www.storyblok.com/tp/nuxt-js-multilanguage-website-tutorial#creating-the-homepage-components

Props should at least define their types vue/require-prop-types

  • 1
    See [prop types](https://vuejs.org/v2/guide/components-props.html#Prop-Types) and [prop validation](https://vuejs.org/v2/guide/components-props.html#Prop-Validation). – Husam Ibrahim Dec 06 '18 at 20:54

2 Answers2

27

You have probably enabled ESlint on project initialization (see create-nuxt-app options), that activated this mandatory rule.

So you have to declare a following type:

  • String
  • Number
  • Boolean
  • Array
  • Object
  • Date
  • Function
  • Symbol

See Vue.js doc:

https://v2.vuejs.org/v2/guide/components-props.html#Prop-Types https://v2.vuejs.org/v2/guide/components-props.html#Type-Checks

For your case:

<script>
export default {
  props: {
    blok: Object
  }
}
</script>
tony19
  • 125,647
  • 18
  • 229
  • 307
Nicolas Pennec
  • 7,533
  • 29
  • 43
17

For current nuxt version(v2.8.1), we should set props as follows:

<script>
export default {
  props: {
    blok: {
      type: Object,
      default: null
    }
  }
}
</script>
SuperStar518
  • 2,814
  • 2
  • 20
  • 35