I'm having trouble figuring out the best way to describe this scenario: I have a list of bases, each with a list of connectors (which could be one or more). I created a filter to sort my bases by their connectors, and here's what my method looks like:
calcBaseList: function() {
let tmp = [];
if (this.filterConnector.length > 0) {
this.listBase.forEach((base) => {
if (this.filterConnector.includes(base.connectors[0].standard)) {
tmp.push(base);
}
});
} else {
tmp = this.listBase;
}
this.filtredBase = tmp;
},
The issue arises when I try to filter for "connector_base_3" and I have a base that includes "connector_base_3" in its connectors but not as the first one on the list. This base doesn't show up in my filtered list.
I attempted changing base.connectors[0].standard
to base.connectors.standard
or base.connectors
, but it doesn't apply the filter correctly.
I apologize if my explanation is a bit unclear. Does anyone have any suggestions on how to resolve this problem?