mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 21:38:13 +00:00
Migracja na Vite
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
methods: {
|
||||
getIcon(name: string, ext = 'svg') {
|
||||
return new URL(`../assets/icon-${name}.${ext}`, import.meta.url).href;
|
||||
},
|
||||
|
||||
getImage(name: string) {
|
||||
return new URL(`../assets/${name}`, import.meta.url).href;
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -1,31 +1,34 @@
|
||||
import { defineComponent, h } from "vue";
|
||||
import { defineComponent, h } from 'vue';
|
||||
import imageMixin from './imageMixin';
|
||||
|
||||
export default defineComponent({
|
||||
data() {
|
||||
return {
|
||||
icons: {
|
||||
arrow: require('@/assets/icon-arrow-asc.svg'),
|
||||
},
|
||||
mixins: [imageMixin],
|
||||
|
||||
showReturnButton: false
|
||||
}
|
||||
data() {
|
||||
return {
|
||||
icons: {
|
||||
arrow: this.getIcon('arrow-asc'),
|
||||
},
|
||||
|
||||
showReturnButton: false,
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
scrollToTop() {
|
||||
window.scrollTo({ top: 0 });
|
||||
},
|
||||
|
||||
methods: {
|
||||
scrollToTop() {
|
||||
window.scrollTo({ top: 0 });
|
||||
},
|
||||
|
||||
handleScroll() {
|
||||
this.showReturnButton = window.scrollY > window.innerHeight * 0.35;
|
||||
}
|
||||
handleScroll() {
|
||||
this.showReturnButton = window.scrollY > window.innerHeight * 0.35;
|
||||
},
|
||||
},
|
||||
|
||||
activated() {
|
||||
window.addEventListener('scroll', this.handleScroll);
|
||||
},
|
||||
activated() {
|
||||
window.addEventListener('scroll', this.handleScroll);
|
||||
},
|
||||
|
||||
deactivated() {
|
||||
window.removeEventListener('scroll', this.handleScroll);
|
||||
},
|
||||
})
|
||||
deactivated() {
|
||||
window.removeEventListener('scroll', this.handleScroll);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import Train from '@/scripts/interfaces/Train';
|
||||
import TrainStop from '@/scripts/interfaces/TrainStop';
|
||||
import { defineComponent } from 'vue';
|
||||
import Train from '../scripts/interfaces/Train';
|
||||
import TrainStop from '../scripts/interfaces/TrainStop';
|
||||
import imageMixin from './imageMixin';
|
||||
|
||||
export default defineComponent({
|
||||
mixins: [imageMixin],
|
||||
|
||||
data: () => ({
|
||||
STATS: {
|
||||
main: [
|
||||
@@ -134,7 +137,7 @@ export default defineComponent({
|
||||
|
||||
onImageError(e: Event) {
|
||||
const imageEl = e.target as HTMLImageElement;
|
||||
imageEl.src = require('@/assets/unknown.png');
|
||||
imageEl.src = this.getImage('unknown.png');
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user