首页 > 其他 > 详细

props with type object/array must use a factory function to return the default value

时间:2020-05-12 11:07:35      阅读:61      评论:0      收藏:0      [点我收藏+]

vue的报错信息已经很清晰了,只要把props中的

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

修改为:

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

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

就可以了。

 

"会让我失望的事,也从来没有辜负过我。"

props with type object/array must use a factory function to return the default value

原文:https://www.cnblogs.com/yanggb/p/12652132.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!