返回 slidev
VClickGap.vue
根目录 / packages / client / builtin / VClickGap.vue
1 <script setup lang="ts">
2 import { Fragment, onMounted, onUnmounted } from 'vue'
3 import { useSlideContext } from '../context'
4 import { makeId } from '../logic/utils'
5
6 const props = defineProps({
7 size: {
8 type: [String, Number],
9 default: 1,
10 },
11 })
12
13 const { $clicksContext: clicks } = useSlideContext()
14 const id = makeId()
15
16 let delta = +props.size
17 if (Number.isNaN(delta)) {
18 console.warn(`[slidev] Invalid size for VClickGap: ${props.size}`)
19 delta = 1
20 }
21
22 onMounted(() => {
23 const max = clicks.currentOffset + delta - 1
24 clicks.register(id, { max, delta })
25 })
26
27 onUnmounted(() => {
28 clicks.unregister(id)
29 })
30 </script>
31
32 <template>
33 <Fragment />
34 </template>
35
35 lines Plain Text