Skip to content

Commit

Permalink
fix: set $clicks to infinity on clicks disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Oct 27, 2023
1 parent 0b281b0 commit 04e3a78
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/client/internals/SlideWrapper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useVModel } from '@vueuse/core'
import type { Ref } from 'vue'
import { defineComponent, h, provide, ref, toRef } from 'vue'
import { computed, defineComponent, h, provide, ref, toRef } from 'vue'
import type { RenderContext } from '@slidev/types'
import { injectionActive, injectionClicks, injectionClicksDisabled, injectionClicksElements, injectionCurrentPage, injectionOrderMap, injectionRenderContext, injectionRoute } from '../constants'

Expand Down Expand Up @@ -48,11 +47,22 @@ export default defineComponent({

clicksElements.value.length = 0

const clicksWithDisable = computed({
get() {
if (clicksDisabled.value)
return 9999999
return +clicks.value
},
set(value) {
clicks.value = value
},
})

provide(injectionRoute, props.route as any)
provide(injectionCurrentPage, ref(+props.route?.path))
provide(injectionRenderContext, ref(props.renderContext as RenderContext))
provide(injectionActive, toRef(props, 'active'))
provide(injectionClicks, clicks as Ref<number>)
provide(injectionClicks, clicksWithDisable)
provide(injectionClicksDisabled, clicksDisabled)
provide(injectionClicksElements, clicksElements as any)
provide(injectionOrderMap, clicksOrderMap as any)
Expand Down

0 comments on commit 04e3a78

Please sign in to comment.