mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
Hotfixy; dodano przyciski powrotu do dla wszystkich widoków
This commit is contained in:
+2
-2
@@ -69,8 +69,8 @@
|
||||
</main>
|
||||
|
||||
<footer class="app_footer">
|
||||
©
|
||||
<a href="https://td2.info.pl/profile/?u=20777" target="_blank">Spythere</a>
|
||||
©
|
||||
<a href="https://td2.info.pl/profile/?u=20777" target="_blank">Spythere</a>
|
||||
{{ new Date().getUTCFullYear() }} | v{{ VERSION }}
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
@@ -258,13 +258,15 @@ export default defineComponent({
|
||||
handleScroll() {
|
||||
this.showReturnButton = window.scrollY > window.innerHeight;
|
||||
|
||||
console.log(window.scrollY > window.innerHeight);
|
||||
|
||||
const element = this.$refs.scrollElement as HTMLElement;
|
||||
|
||||
if (
|
||||
element.getBoundingClientRect().bottom * 0.85 < window.innerHeight &&
|
||||
this.scrollDataLoaded &&
|
||||
!this.scrollNoMoreData &&
|
||||
window.scrollY > window.innerHeight
|
||||
this.historyDataStatus.status == DataStatus.Loaded
|
||||
)
|
||||
this.addHistoryData();
|
||||
},
|
||||
|
||||
@@ -297,7 +297,7 @@ export default defineComponent({
|
||||
element.getBoundingClientRect().bottom * 0.85 < window.innerHeight &&
|
||||
this.scrollDataLoaded &&
|
||||
!this.scrollNoMoreData &&
|
||||
window.scrollY > window.innerHeight
|
||||
this.historyDataStatus.status == DataStatus.Loaded
|
||||
)
|
||||
this.addHistoryData();
|
||||
},
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<template>
|
||||
<section class="station_table">
|
||||
<button class="return-btn" @click="scrollToTop" v-if="showReturnButton">
|
||||
<img :src="icons.arrow" alt="return arrow" />
|
||||
</button>
|
||||
|
||||
<div class="table_wrapper">
|
||||
<table>
|
||||
<thead>
|
||||
@@ -231,6 +235,7 @@
|
||||
import styleMixin from '@/mixins/styleMixin';
|
||||
import dateMixin from '@/mixins/dateMixin';
|
||||
import stationInfoMixin from '@/mixins/stationInfoMixin';
|
||||
import returnBtnMixin from '@/mixins/returnBtnMixin';
|
||||
|
||||
import { DataStatus } from '@/scripts/enums/DataStatus';
|
||||
import { computed, ComputedRef, defineComponent } from '@vue/runtime-core';
|
||||
@@ -255,7 +260,7 @@ export default defineComponent({
|
||||
changeSorter: { type: Function, required: true },
|
||||
},
|
||||
|
||||
mixins: [styleMixin, dateMixin, stationInfoMixin],
|
||||
mixins: [styleMixin, dateMixin, stationInfoMixin, returnBtnMixin],
|
||||
|
||||
data: () => ({
|
||||
likeIcon: require('@/assets/icon-like.svg'),
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<template>
|
||||
<div class="train-table" @keydown.esc="closeTimetable" v-click-outside="closeTimetable">
|
||||
<button class="return-btn" @click="scrollToTop" v-if="showReturnButton">
|
||||
<img :src="icons.arrowAsc" alt="return arrow" />
|
||||
</button>
|
||||
|
||||
<transition name="anim" mode="out-in">
|
||||
<div :key="trainsDataStatus">
|
||||
<!-- <div class="traffic-warning" v-if="data.">
|
||||
@@ -45,6 +49,7 @@ import TrainInfo from '@/components/TrainsView/TrainInfo.vue';
|
||||
|
||||
import { DataStatus } from '@/scripts/enums/DataStatus';
|
||||
import { GETTERS } from '@/constants/storeConstants';
|
||||
import returnBtnMixin from '@/mixins/returnBtnMixin';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@@ -52,6 +57,8 @@ export default defineComponent({
|
||||
TrainInfo,
|
||||
},
|
||||
|
||||
mixins: [returnBtnMixin],
|
||||
|
||||
props: {
|
||||
trains: {
|
||||
type: Array as () => Train[],
|
||||
@@ -107,9 +114,9 @@ export default defineComponent({
|
||||
this.searchedDriver = query.driverName.toString();
|
||||
this.searchedTrain = query.trainNo.toString();
|
||||
|
||||
setTimeout(() => {
|
||||
this.chosenTrainId = query.driverName + <string>query.trainNo;
|
||||
}, 20);
|
||||
setTimeout(() => {
|
||||
this.chosenTrainId = query.driverName + <string>query.trainNo;
|
||||
}, 20);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import { defineComponent, h } from "vue";
|
||||
|
||||
export default defineComponent({
|
||||
data() {
|
||||
return {
|
||||
icons: {
|
||||
arrow: require('@/assets/icon-arrow-asc.svg'),
|
||||
},
|
||||
|
||||
showReturnButton: false
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
scrollToTop() {
|
||||
window.scrollTo({ top: 0 });
|
||||
},
|
||||
|
||||
handleScroll() {
|
||||
this.showReturnButton = window.scrollY > window.innerHeight;
|
||||
}
|
||||
},
|
||||
|
||||
activated() {
|
||||
window.addEventListener('scroll', this.handleScroll);
|
||||
},
|
||||
|
||||
deactivated() {
|
||||
window.removeEventListener('scroll', this.handleScroll);
|
||||
},
|
||||
})
|
||||
@@ -259,7 +259,7 @@ ul {
|
||||
bottom: 0;
|
||||
|
||||
z-index: 100;
|
||||
|
||||
|
||||
margin: 0 1em 1em 0;
|
||||
|
||||
width: 2em;
|
||||
|
||||
Reference in New Issue
Block a user