<template>
  <!-- <headers :title="pdfState.title" /> -->
  <view class="pdf-container">
    <web-view class="webview" :src="pdfState.pdfUrl"></web-view>
  </view>
</template>

<script setup lang="ts">
// import headers from "@/components/header/index.vue"

const pdfState = reactive({
  title: "",
  pdfUrl: "",
  viewerUrl: "/static/pdf/web/viewer.html",
})

onLoad((options: any) => {
  pdfState.title = options.name
  pdfState.pdfUrl =
    pdfState.viewerUrl + "?file=" + encodeURIComponent(options.url)
})

onReady(() => {
  uni.setNavigationBarTitle({
    title: pdfState.title,
  })
})
</script>

<style lang="scss" scoped>
.pdf-container {
  width: 100vw;
  height: 100vh;
  .webview {
    height: 90%;
  }
}
</style>
