码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2020-05-12 10:10:47      阅读:62      评论:0      收藏:0      [点我收藏+]

标签:cto   nbsp   efault   span   style   with   default   col   return   

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

标签:cto   nbsp   efault   span   style   with   default   col   return   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!