2022-09-06 Invalid default value for prop "value": 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: { value: { type: String, default: "", }, }
解决方案:把default的写法换成这样👇
props: { value: { type: String, default: () => { return ""; }, }, }