1- <script setup>
1+ <script setup lang="ts" >
22import { inject , onMounted , useTemplateRef } from " vue"
33
44import TroubleshooterStepOption from " ./TroubleshooterStepOption.vue"
5+ import type { Option , Step } from " @/troubleshooter"
56
6- const debug = inject (" debug" )
7+ const debug = inject < boolean > (" debug" )
78
8- const emit = defineEmits ([" choose" ])
9+ const emit = defineEmits <{
10+ choose: [Option ]
11+ }>()
912
10- const props = defineProps ({
11- step: {
12- type: Object ,
13- required: true ,
14- },
15- active: {
16- type: Boolean ,
17- default: false ,
18- },
19- })
13+ defineProps <{
14+ step: Step
15+ active? : boolean
16+ }>()
2017
2118const containerRef = useTemplateRef (" container" )
2219
2320onMounted (() => {
24- const { top , bottom } = containerRef .value .getBoundingClientRect ()
21+ const { top } = containerRef .value ! .getBoundingClientRect ()
2522 const minVisibleHeight = 50
2623 const isVisible = top + minVisibleHeight < window .innerHeight
27- if (! isVisible) containerRef .value .scrollIntoView ({ behavior: " smooth" })
24+ if (! isVisible ) containerRef .value ! .scrollIntoView ({ behavior: " smooth" })
2825})
2926 </script >
3027
@@ -46,12 +43,12 @@ onMounted(() => {
4643 v-for =" option in step.options"
4744 :key =" option.hash"
4845 :option =" option"
49- @click =" $ emit('choose', option)"
46+ @click =" emit('choose', option)"
5047 />
5148 </div >
5249 <p v-if =" debug" class =" small" >
53- <a :href =" 'vscode://file/' + step.fullPath.replaceAll('\\', '/')" >
54- {{ step.filename }}
50+ <a :href =" 'vscode://file/' + step.fullPath! .replaceAll('\\', '/')" >
51+ {{ step.filename! }}
5552 </a >
5653 </p >
5754 </div >
0 commit comments