1. 程式人生 > 其它 >vue 父子元件傳陣列eslint報錯(Type of the default value for ‘arrNew‘ prop must be a function)

vue 父子元件傳陣列eslint報錯(Type of the default value for ‘arrNew‘ prop must be a function)

技術標籤:筆記2021javascriptvue

報錯

Type of the default value for ‘arrNew’ prop must be a function. (vue/require-valid-default-prop)

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

解決

arrNew: {
  type: Array,
  default() {
    return []
  }
}

vue 父子元件傳陣列eslint報錯(Type of the default value for ‘arrNew’ prop must be a function)