Vuejs Error, Invalid Prop: Type Check Failed for Prop. Expected Date, Got Number With Value

Vuejs error, Invalid prop: type check failed for prop. Expected Date, got Number with value

This is because you pass in an expression in props javascript. From your example: 11 - 31 - 2011 === -1991.

I recommend reading the documentation for understanding props:
https://v2.vuejs.org/v2/guide/components-props.html#Passing-Static-or-Dynamic-Props

You can fix it as follows:

<my-component
v-bind:first-date="new Date('12-12-2019')"
v-bind:second-date="new Date('31-11-2011')"
></my-component>

[Vue warn]: Invalid prop: type check failed for prop "productCartData". Expected Object, got String with value "[object Object]"

You cant pass getter cart of array as params in router link. if you want access getter of cart into your component just access it directly in that component.

or you don't event need getter. just create a computed property in your component.

params can only be string or number and they need to be declared in router

read for params.
https://next.router.vuejs.org/guide/essentials/dynamic-matching.html

to access objects arrays from store or data of components just use computed property.

[Vue warn]: Invalid prop: type check failed for prop "xxx". Expected Number with value X, got String with value "X"

You need to add the .number modifier to v-model, otherwise the type from the input will be string.

<v-text-field v-model.number="daysNumber" type="number"></v-text-field>

VueJs - Invalid prop: type check failed for prop "page". Expected DocumentPageDto, got Object

Instead of declaring props like

props: {
page: DocumentPageDto,
}

Use a property and apply the @Prop decorator from the vue-property-decorator library works just fine.

@Prop()
diagram: DiagramDto = null;


Related Topics



Leave a reply



Submit