Skip to content

Slide export doesn't handle v-if in global-top or global-bottom based on conditional using currentPage, currentLayout #1490

@ani-per

Description

@ani-per

Describe the bug

The exporter seems to fail to handle v-if conditionals in global-top or global-bottom that use currentPage, currentLayout, and other navigation composables.

My global bottom is intended to only be displayed on non-cover slides after the first. This functions properly in browser view but fails to display properly on export.

<script setup lang="ts">
// import { computed } from "vue";
import { useNav, useSlideContext } from "@slidev/client"

// const { $slidev, $route } = useSlideContext()
const { currentPage, currentLayout } = useNav()
</script>

<template>
  <div v-if="currentPage.value > 1 && currentLayout !== 'cover'" class="slide-footer absolute w-full bottom-0 left-0 p-0 text-sm" style="display: grid; grid-template-columns: 33.33% 33.33% 33.34%; color: #ffffff">
    <div class="footer-comp justify-start" style="display: flex; flex-direction: row; gap: 7px; padding-left: 10px">
      <Item text="Ani Perumalla">
        <carbon:user-avatar-filled-alt />
      </Item>
      <Item text="ani-per.gitlab.io">
        <carbon:link />
      </Item>
    </div>
    <div class="footer-comp justify-center" style="display: flex; flex-direction: row; gap: 4px; padding-top: 4px; padding-bottom: 4px;">
      <img src="./img/logos/PSU_Engineering.png" alt="PSU Mark">
      <img src="./img/logos/PSU_Aero.png" alt="PSU Mark">
    </div>
    <div class="footer-comp justify-end" style="display: flex; flex-direction: row; gap: 7px; padding-right: 10px">
      <Item text="PSU UAS Research Lab">
        <carbon:drone />
      </Item>
      <Item text="<a href='https://purl.psu.edu'>purl.psu.edu</a>">
        <carbon:link />
      </Item>
    </div>
  </div>
</template>

This produces a proper global bottom in browser view, but no global bottom in the exported pdf:

Correct browser view

Incorrect exported pdf slide

When I remove the conditional v-if="currentPage.value > 1 && currentLayout !== 'cover'" from the first div in the template, the exporter displays the global bottom correctly:

Correct exported pdf slide

Desktop

  • OS: Windows 11
  • Browser: Brave, Firefox, Edge
  • Slidev version: 0.48.8

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions