Filtrowanie kategoriami RJ (w.i.p.)

This commit is contained in:
2021-12-22 20:19:47 +01:00
parent 604a5ba0d7
commit 7975430c6f
2 changed files with 15 additions and 2 deletions
+9 -1
View File
@@ -82,7 +82,7 @@
import ActionButton from "@/components/Global/ActionButton.vue"; import ActionButton from "@/components/Global/ActionButton.vue";
import Train from "@/scripts/interfaces/Train"; import Train from "@/scripts/interfaces/Train";
import { computed, defineComponent } from "@vue/runtime-core"; import { computed, defineComponent, inject } from "@vue/runtime-core";
export default defineComponent({ export default defineComponent({
components: { ActionButton }, components: { ActionButton },
@@ -220,12 +220,16 @@ export default defineComponent({
return [twrList.length, skrList.length]; return [twrList.length, skrList.length];
}); });
/* Inject list from TrainsView for category filter */
const chosenTrainCategories = inject("chosenTrainCategories") as string[];
return { return {
speedStats, speedStats,
timetableStats, timetableStats,
categoryList, categoryList,
locoList, locoList,
specialTrainCount, specialTrainCount,
chosenTrainCategories
}; };
}, },
}); });
@@ -289,6 +293,10 @@ export default defineComponent({
} }
} }
/* .category {
cursor: pointer;
} */
.category, .category,
.special { .special {
&-list { &-list {
+6 -1
View File
@@ -18,7 +18,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { computed, ComputedRef, defineComponent, ref } from "vue"; import { computed, ComputedRef, defineComponent, provide, reactive, ref } from "vue";
import { DataStatus } from "@/scripts/enums/DataStatus"; import { DataStatus } from "@/scripts/enums/DataStatus";
import Train from "@/scripts/interfaces/Train"; import Train from "@/scripts/interfaces/Train";
@@ -125,12 +125,17 @@ export default defineComponent({
); );
}); });
/* Provide list for TrainStats category filter */
const chosenTrainCategories = reactive([] as string[]);
provide('chosenTrainCategories', chosenTrainCategories);
return { return {
trainList, trainList,
computedTrains, computedTrains,
searchedTrain, searchedTrain,
searchedDriver, searchedDriver,
sorterActive, sorterActive,
chosenTrainCategories
}; };
}, },