【Vue-bug】[Vue warn]:Invalid prop: type check failed for prop “data“.Expected Array,got Object 

props: {
    commentInfo: {
      type: Array,
      default() {
        return [];
      }
    }
  },

//这里的type是一个数组,但是父传子时却传过来一个对象,所以报错
//把type和return改回Object即可
props: {
    commentInfo: {
      type: Object,
      default() {
        return {};
      }
    }
  },

 

 

 

相关文章:

  • 2021-07-13
  • 2022-01-12
  • 2021-10-12
  • 2022-12-23
  • 2021-05-24
  • 2021-11-09
  • 2022-12-23
猜你喜欢
  • 2021-10-24
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-27
  • 2022-12-23
相关资源
相似解决方案