<template>
  <div class="pdf-viewer">
    <iframe
      :src="`https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURIComponent(pdfUrl)}`"
      class="pdf-iframe"
      frameborder="0"
    />
  </div>
</template>

<script setup lang="ts">
import { defineProps } from 'vue'
 
// 使用 TypeScript 的类型注解来定义 props
const props = defineProps<{
  pdfUrl: string
}>()
 
// 组件名称
const name = 'PdfViewer'
</script>

<style lang="scss" scoped>
.pdf-viewer {
  width: 100%;
  height: 500px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

.pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
}
</style> 