Skip to content

useNav() property currentSlideNo is not reactive when exporting the slides to pdf #1776

@johannchopin

Description

@johannchopin

First of all thanks for the work put on this project 👏

Context

I wanted to create a vue computed function useBreadcrumb that based on tocTree and currentSlideNo from useNav() give back the array of titles to be able to render a breadcrumb on each slides. Final goal was to release an add-on.

Describe the bug

When I use the following approach to display the current slide number, it's working well in the webview but during the export to pdf the value is always 1:

<script>
import {  useNav } from '@slidev/client'
const { currentSlideNo } = useNav()
</script>

<template>
  {{ currentSlideNo }}
</template>

I don't have this issue when I use directly $nav.currentSlideNo.

Minimal reproduction

I created a minimal reproductible example at https://github.com/johannchopin/slidev-currentSlideNo-bug-in-pdf. In the global-bottom.vue file I display the value of $nav.currentSlideNo and the SlideNo.vue component render the currentSlideNo value. The result can be see in the exported PDF slides-export.pdf.

Environment

  • Slidev version: Used @slidev/cli@^0.49.20 to generate the dummy repo
  • Browser: Chrome
  • OS: Windows

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions