Props with type Object/Array must use a factory function to return the default value.

 

 父子传值,报错代码:

 

 报错信息:

Props with type Object/Array must use a factory function to return the default value.(数组/对象的默认值应当由一个工厂函数返回)

解决办法:

1、箭头函数

props: {
    actData: {
      type: Object,
      default: () => {},
    },
},

2、普通函数

props: {
    actData: {
      type: Object,
      default: function () {
        return {};
      },
    },
},

 

posted @ 2022-12-24 15:28  云里知音  阅读(179)  评论(0)    收藏  举报