欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

Property propDD has no initializer and is not definitely assigned in the constructor 有大用 有大大用

1、object类

解决方案  

  1. 检测报错代码
  2. @Prop() propDD: object;
  3. 修改后
  4. 方式一
  5. @Prop({ type: Object, default: {} }) propDD: any;
  6. 方式二
  7. @Prop() propDD?: object;

2、array类型

解决方案

  1. 检测报错代码
  2. @Prop() propF: string[];
  3. @Prop() propG: Array<number>;
  4. 修改后
  5. @Prop() propF?: string[];
  6. @Prop() propG?: Array<number>;

 

文章知识点与官方知识档案匹配,可进一步学习相关知识
普通分类: