mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
feature: nawigacja URL w widoku scenerii
This commit is contained in:
@@ -18,9 +18,9 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="historyItem in historyList" :key="historyItem.id">
|
<tr v-for="historyItem in historyList" :key="historyItem.id">
|
||||||
<td>
|
<td>
|
||||||
<router-link :to="`/journal/timetables?timetableId=${historyItem.id}`"
|
<router-link :to="`/journal/timetables?timetableId=${historyItem.id}`">
|
||||||
>#{{ historyItem.id }}</router-link
|
#{{ historyItem.id }}
|
||||||
>
|
</router-link>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<b class="text--primary">{{ historyItem.trainCategoryCode }}</b> <br />
|
<b class="text--primary">{{ historyItem.trainCategoryCode }}</b> <br />
|
||||||
|
|||||||
+2
-1
@@ -61,7 +61,8 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
scrollBehavior(to, from, savedPosition) {
|
scrollBehavior(to, from, savedPosition) {
|
||||||
if (to.name == 'SceneryView' && from.name) return { el: `.app_main` };
|
if (to.name == 'SceneryView' && from.name && from.query['view'] === undefined)
|
||||||
|
return { el: `.app_main` };
|
||||||
|
|
||||||
if (savedPosition) return savedPosition;
|
if (savedPosition) return savedPosition;
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
:key="i"
|
:key="i"
|
||||||
class="btn btn--option"
|
class="btn btn--option"
|
||||||
@click="setViewMode(viewMode.component)"
|
@click="setViewMode(viewMode.component)"
|
||||||
:data-checked="currentViewCompontent == viewMode.component"
|
:data-checked="currentMode == viewMode.component"
|
||||||
>
|
>
|
||||||
{{ $t(viewMode.id) }}
|
{{ $t(viewMode.id) }}
|
||||||
</button>
|
</button>
|
||||||
@@ -35,10 +35,10 @@
|
|||||||
|
|
||||||
<keep-alive>
|
<keep-alive>
|
||||||
<component
|
<component
|
||||||
:is="currentViewCompontent"
|
:is="currentMode"
|
||||||
:onlineScenery="onlineSceneryInfo"
|
:onlineScenery="onlineSceneryInfo"
|
||||||
:station="stationInfo"
|
:station="stationInfo"
|
||||||
:key="currentViewCompontent"
|
:key="currentMode"
|
||||||
></component>
|
></component>
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
</div>
|
</div>
|
||||||
@@ -113,9 +113,9 @@ export default defineComponent({
|
|||||||
onlineFrom: -1
|
onlineFrom: -1
|
||||||
}),
|
}),
|
||||||
|
|
||||||
activated() {
|
// activated() {
|
||||||
this.loadSelectedCheckpoint();
|
// this.loadSelectedCheckpoint();
|
||||||
},
|
// },
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@@ -128,6 +128,10 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
currentMode() {
|
||||||
|
return this.$route.query.view ?? 'SceneryTimetable';
|
||||||
|
},
|
||||||
|
|
||||||
stationInfo() {
|
stationInfo() {
|
||||||
return this.store.stationList.find(
|
return this.store.stationList.find(
|
||||||
(station) => station.name === this.station?.toString().replace(/_/g, ' ')
|
(station) => station.name === this.station?.toString().replace(/_/g, ' ')
|
||||||
@@ -145,7 +149,13 @@ export default defineComponent({
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
setViewMode(componentName: string) {
|
setViewMode(componentName: string) {
|
||||||
this.currentViewCompontent = componentName;
|
this.$router.push({
|
||||||
|
path: this.$route.path,
|
||||||
|
query: {
|
||||||
|
...this.$route.query,
|
||||||
|
view: componentName
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
loadSelectedCheckpoint() {
|
loadSelectedCheckpoint() {
|
||||||
|
|||||||
Reference in New Issue
Block a user