在组件中接受props参数时,如果接受的是数组或对象类型,则default值应该用一个方法return返回
否则报错:
Invalid default value for prop “slides”: Props with type Object/Array must use a factory function to return the default value
props: {
parentlistAr: {
type: Array,
default: () => []
},
parentObj: {
type: Object,
default: () => ({})
}
},
6636

被折叠的 条评论
为什么被折叠?



