File tree 2 files changed +36
-0
lines changed
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ <script setup lang="ts">
2
+ import { onMounted , watch } from " vue"
3
+ import { useTravelStore } from " @/store"
4
+ import { storeToRefs } from " pinia"
5
+
6
+ const travelStore = useTravelStore ()
7
+ const { cooldownTimeLeft } = storeToRefs (travelStore )
8
+
9
+ const travelButton = document .querySelector <HTMLButtonElement >(" .px-4.py-4 button" )
10
+
11
+ watch (
12
+ cooldownTimeLeft ,
13
+ (val ) => {
14
+ if (! val ) return
15
+ if (! travelButton ) return
16
+
17
+ setTimeout (() => {
18
+ travelButton .focus ()
19
+ }, val + 10 )
20
+ },
21
+ {
22
+ immediate: true ,
23
+ }
24
+ )
25
+
26
+ onMounted (() => {
27
+ if (! travelButton ) return
28
+ travelButton .focus ()
29
+ })
30
+ </script >
31
+
32
+ <template >
33
+ <slot ></slot >
34
+ </template >
Original file line number Diff line number Diff line change 2
2
import TravelBridge from " ./TravelBridge.vue"
3
3
import TravelBar from " ./TravelBar.vue"
4
4
import TravelButton from " ./TravelButton.vue"
5
+ import AutoFocus from " ./AutoFocus.vue"
5
6
</script >
6
7
7
8
<template >
8
9
<TravelBridge />
9
10
<TravelBar />
10
11
<TravelButton />
12
+ <AutoFocus />
11
13
</template >
You can’t perform that action at this time.
0 commit comments