prismicio / prismic-vue

Vue plugin, components, and composables to fetch and present Prismic content
https://prismic.io/docs/technologies/vuejs
Apache License 2.0
65 stars 16 forks source link

Example code show Vue warning "Invalid prop" #36

Closed supermueller closed 3 years ago

supermueller commented 4 years ago

If you follow the instructions in the readme, you get an Vue warning saying Invalid prop: type check failed for prop "field". Expected Array, got Null.

To fix this, avoid using null when init the properties; instead use empty arrays or objects:

export default {
  name: 'MyComponent',
  data() {
    return {
      fields: {
        title: [],
        logo: {},
        somethingRich: []
      }
    }
  },
  …
}
lihbr commented 4 years ago

Hey @supermueller thank you for contributing, nice catch! If you're willing to make a quick PR that's more than appreciated ☺️

KayJay89 commented 4 years ago

The documents over at https://prismic.io/docs/vuejs/getting-started/integrating-with-an-existing-project should also be updated.