[Vuejs]-Why variable is not defined in created() method

0👍

Try to defined a default value for your myData array, like this

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

By the way props are used to pass data from parent to child, I don’t think this is the best way to do this.

0👍

myDataCol1,2,3 should be computed properties :

props: {
  myData: {
    default: [],
    type: Array,
  },
},
computed: {
  myDataCol1(){
    return this.myData.slice(0, this.myData.length/3)
  }
  .
  .
  .
}

Leave a comment