Вы не должны создавать ссылки. На самом деле вы устанавливаете ссылку на ваш исходный массив, и тогда все мутации против вашей копии будут отражены в исходном массиве.
onTextChanged: function () {
console.log("this.data.stationInfo.stations.length", this.data.stationInfo.stations.length);
let newArray = this.data.stationInfo.stations
.filter(el => {
return el.eng站名.toLowerCase().startsWith(this.data.searchBar.search.toLowerCase())
||
el.站名.toLowerCase().startsWith(this.data.searchBar.search.toLowerCase())
||
el.traWebsiteCode.startsWith(this.data.searchBar.search.toLowerCase())
});
this.data.resultDetails.stations = newArray;
console.log("copy.length", copy.length);
console.log("after copy.length this.data.stationInfo.stations.length", this.data.stationInfo.stations.length);
}
Также я бы посоветовал вам улучшить ваш код и сделать все необходимое в одном месте. Вы можете перебирать массив и напрямую исключать все необходимые станции. Вот пример:
onTextChanged: function () {
const stations = this.data.stationInfo.stations;
function doSearch(el,str) {
return
el.eng站名.toLowerCase().startsWith(str) ||
el.站名.toLowerCase().startsWith(str) ||
el.traWebsiteCode.startsWith(str);
}
for(let j=0; j < stations.length; j++){
if(!doSearch(stations[j], this.data.searchBar.search.toLowerCase())){
stations.splice(j, 1);
}
}
console.log(stations);
}