Vue Error: Invalid prop: type check failed for prop "participants". Expected Object, got Array

Viewed 2102

I'm attempting to pass data from my Parent Component to my Child Component.

Parent Component:

export default {
  props: {
    bordered: true,
    striped: true,
    participants:
        {
        primaryAlias : '',
        primaryEmail : '',
        primaryAddress : '',
        primaryPhone: '',
      }
  },

Child Component:

    export default {
  props: {
    participants: [
        {
      type: Object,
      value: ''
    },
  ]
  },

However, I'm running into many prop errors. Currently I receive the error in my Child Component:

Vue Error: Invalid prop: type check failed for prop "participants". Expected Object, got Array 

However, when I attempt to rectify it like this:

export default {
  props: {
    participants: [
        {
      type: Object,
      value: ''
    },
  ]
  },

I receive the following error, again in child component.

Invalid prop type: "[object Object]" is not a constructor

I've tried rewriting many times, but nothing seems to work, happy to hear tips.

1 Answers

update like below then hope solve the issue

when participants is object type:

    export default {
      props: {
        participants:
            {
          type: Object,
          default: {}
        },
      },

when participants is array type:

 export default {
      props: {
        participants:
            {
          type: Array,
          default: []
        },
      },

you can read more from here

Related