File tree 1 file changed +17
-4
lines changed
1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change 1
1
<script setup lang="ts">
2
- import type { PropType } from " vue" ;
2
+ import { onMounted , type PropType , ref } from " vue" ;
3
3
import type {Api } from " @shared/api" ;
4
4
import GTASAArtwork from " @/assets/images/gtasa-artwork.jpg" ;
5
5
import GTAIIIBG from " @/assets/images/iii-bg.png" ;
@@ -11,18 +11,31 @@ defineProps({
11
11
}
12
12
});
13
13
14
+ const loadingImageRef = ref <HTMLDivElement >();
15
+
14
16
const imageSrcs: Record <Api .GameKey , string > = {
15
17
iii: GTAIIIBG ,
16
18
sa: GTASAArtwork ,
17
19
vc: ' '
18
20
}
19
21
22
+ onMounted (() => {
23
+ if (loadingImageRef .value === undefined ) {
24
+ console .error (' Cannot find loading image element' );
25
+ return ;
26
+ }
27
+
28
+ const loadingImageEl = loadingImageRef .value
29
+
30
+ document .addEventListener (' click' , () => {
31
+ loadingImageEl .classList .remove (' loading-image--active' );
32
+ });
33
+ })
34
+
20
35
</script >
21
36
22
37
<template >
23
- <div class =" loading-image loading-image--active" :class =" `loading-image--${game}`" @click =" (e) => {
24
- (e.currentTarget as HTMLDivElement).classList.remove('loading-image--active');
25
- }" >
38
+ <div ref =" loadingImageRef" class =" loading-image loading-image--active" :class =" `loading-image--${game}`" >
26
39
<img :src =" imageSrcs[game]" alt =" Game background" >
27
40
<span >Click to continue</span >
28
41
</div >
You can’t perform that action at this time.
0 commit comments