-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useNav() property currentSlideNo is not reactive when exporting the slides to pdf #1776
Comments
How about move Global layers are considered singleton, which may cause problems when exporting. Or try the following code instead: import { useSlideContext } from '@slidev/client'
const { $nav } = useSlideContext()
$nav.value.currentSlideNo |
@KermanX Thanks for the fast reply. In my real case issue it's not related to the I still found a bit weird that |
In fact, this has been a long-standing problem. The root cause is that there are different navigation states for each slide when exporting without the However, we can improve this by using the same way as |
That would be nice yes 👍 As there is a "solid" workaround I don't think it's a critical bug, but maybe it would be nice to add a Tip note in the composable usage documentation (something equivalent to https://sli.dev/features/global-layers#global-layers). What do you think? |
First of all thanks for the work put on this project 👏
Context
I wanted to create a vue computed function
useBreadcrumb
that based ontocTree
andcurrentSlideNo
fromuseNav()
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
: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 thecurrentSlideNo
value. The result can be see in the exported PDF slides-export.pdf.Environment
@slidev/cli@^0.49.20
to generate the dummy repoThe text was updated successfully, but these errors were encountered: