天天看点

前端vue:解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题

前台页面报错“Invalid prop: type check failed for prop “model”. Expected Object, got Array ”

前端vue:解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题

错误是:期望对象,得到的是数组

前端vue:解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题

第一种情况:

组件传值

1、父组件

前端vue:解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题

2、子组件

前端vue:解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题

3、报错提示

前端vue:解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题
改正
前端vue:解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题

第二种情况:

获取数据的代码为

前端vue:解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题

改为:

前端vue:解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题
前端vue:解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题

继续阅读