Tag Archives: sling

error: Type of the default value for ‘tableData‘ prop must be a function

when writing props to the vue component, set the default value as follows, and an eslint syntax error appears: error: Type of the default value for ‘tableData’ prop must be a function (the default value for the tableData property must be a function).

props: {
  tableData: {
    type: Array,
    default: [],
  }
},

How does

change?Use Array/Object in props as default value.

props: {
  tableData: {
    type: Array,
    default: () => [],
    // 或者 default: function () { return [] }
  }
},