Skip to content

Commit

Permalink
Update packages/slidev/node/virtual/titles.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <github@antfu.me>
  • Loading branch information
KermanX and antfu committed Mar 26, 2024
1 parent e7902c3 commit c4673c8
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions packages/slidev/node/virtual/titles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ export const templateTitleRendererMd: VirtualModuleTemplate = {
.map(({ title }, i) => `<template ${i === 0 ? 'v-if' : 'v-else-if'}="no === ${i + 1}">\n\n${title}\n\n</template>`)

lines.push(
[
`<script setup lang="ts">`,
`import { useSlideContext } from '@slidev/client'`,
`import { computed } from 'vue'`,
`const props = defineProps<{ no?: number | string }>()`,
`const { $page } = useSlideContext()`,
`const no = computed(() => +(props.no ?? $page.value))`,
`</script>`,
].join('\n'),
`<script setup lang="ts">`,
`import { useSlideContext } from '@slidev/client'`,
`import { computed } from 'vue'`,
`const props = defineProps<{ no?: number | string }>()`,
`const { $page } = useSlideContext()`,
`const no = computed(() => +(props.no ?? $page.value))`,
`</script>`,
)

return lines.join('\n')
Expand Down

0 comments on commit c4673c8

Please sign in to comment.