[Vuejs]-How can I get computed property from methods?

0👍

const len = this.columns.length // length of `columns` array

Next line:

for (let i = len + 1; i <= len + 5; i++) {
  ...this.columns[i]

You’re trying to access indexes above array’s length, which values are undefined obviously.

You should probably just loop through columns like this:

for (let column of columns) {
   for (let item of column) { // asuming column is Array(4)
      console.log(item)

It should work if your columns is an array of ‘chunk’ arrays with 4 elements in each.

0👍

you this keyword to get computed method like this:

item.push(this.column[i]);

Leave a comment