组件是默认值报错:Props with type Object/Array must use a factory function to return the default value

产生问题的出处

@Prop({
    type: Object,
    default:  { picTypeNicNames: [], sriovTypeNicNames: [] };
    }
  })
  private usedNicNameList!: any;

解决办法 props传递数据的时候,默认值如果是数组或者对象,应该使用一个函数返回默认值

@Prop({
    type: Object,
    // Props with type Object/Array must use a factory function to return the default value.
    default: () => {
      return { picTypeNicNames: [], sriovTypeNicNames: [] };
    }
  })
  private usedNicNameList!: any;

你可能感兴趣的:(组件是默认值报错:Props with type Object/Array must use a factory function to return the default value)