[Vuejs]-Can I validate that a prop has a particular shape?

-1👍

In your component prop property, declare your user property of type Object

props: {
  user: {
    type: Object,
    default: {}
  }
}

Then your component template should have something like this

<my-component 
  :user="{ 
    username: 'Chris', 
    email: 'something@email.com' 
  }"
></my-component>

Leave a comment