Poprawka w działaniu sortowania wyszukiwarki scenerii

This commit is contained in:
2022-11-01 18:27:27 +01:00
parent 6988a83355
commit 69772460b8
@@ -17,7 +17,7 @@
/>
<datalist id="sceneries">
<option v-for="scenery in store.stationList" :value="scenery.name"></option>
<option v-for="scenery in sortedStationList" :value="scenery.name"></option>
</datalist>
</label>
</div>
@@ -150,6 +150,14 @@ export default defineComponent({
this.currentRegion = this.store.region;
},
computed: {
sortedStationList() {
return this.store.stationList
.filter((s) => s.name.toLocaleLowerCase().includes(this.chosenSearchScenery.toLocaleLowerCase()))
.sort((s1, s2) => (s1.name > s2.name ? 1 : -1));
},
},
watch: {
chosenSearchScenery(value: string) {
const chosenStation = this.store.stationList.find(({ name }) => name == value);