[Vuejs]-Access returned computed array within method and manipulate

0👍

It looks like the issue is the line:

var ret = this.selected.concat(this.selected2, this.selected3);

That line of code is returning an empty string rather than an array. This is because this.selectedX is a string rather than an Array. This explains why tag.forEach is undefined. forEach doesn’t exist on the String prototype.

You can create this an array instead be doing

var ret = [ this.selected, this.selected2, this.selected3 ]

From there you can set this.tagArray to ret

Hope this helps

Leave a comment