export default {
props: {

slides:{
  type:Array,
  default:[]
}

},这是我的代码

报错是Invalid default value for prop "slides": Props with type Object/Array must use a factory function to return the default value.

// 数组/对象的默认值应当由一个工厂函数返回

// 这是文档里的例子,返回对象
propE: {
  type: Object,
  default: function () {
    return { message: 'hello' }
  }
},
// 返回数组的默认值
proE: {
    type: Array,
    default: function () {
        return []
    }
}

 

相关文章:

  • 2021-07-16
  • 2021-06-29
  • 2021-04-29
  • 2021-07-25
  • 2022-12-23
  • 2021-05-15
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案