vue中报错Props with type Object/Array must use a factory function to return the default value

Posted eternityz

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue中报错Props with type Object/Array must use a factory function to return the default value相关的知识,希望对你有一定的参考价值。

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

正确书写方式

<script>
export default{
    props:{
        list:{
            type: [Object,Array],
            default: ()=>{}
        },
        arr:{
            type: Array,
            default: ()=>[]
        },
        obj:{
            type: Object,
            default: ()=>{}
        }
    }
}
<script>

以上是关于vue中报错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

Java中报错No enclosing instance of type caiquan is accessible. Must qualify the allocation with an encl

Vue ElementUI 中报错:this.$message is not a function

VUE props的坑(Props with type Object/Array must use a factory function to return the default value)(代码

Vue 提示Invalid default value for prop “tableData“: Props with type Object/Array must use a factory(代码

静态成员变量初始化在vs中报错“error LNK2005 static VimbaSystem...已经在...obj中定义”