PdfViewer.vue 591 B

123456789101112131415161718192021222324252627282930
  1. <template>
  2. <iframe :title="title" :src="pdfSrc" :width="width" :height="height" style="border: none;" />
  3. </template>
  4. <script setup lang="ts">
  5. import { withBase } from 'vitepress'
  6. import { computed } from 'vue-demi'
  7. const props = defineProps({
  8. title: {
  9. type: String,
  10. default: ''
  11. },
  12. file: {
  13. type: String,
  14. required: true
  15. },
  16. width: {
  17. type: String,
  18. default: '100%'
  19. },
  20. height: {
  21. type: String,
  22. default: '600px'
  23. }
  24. })
  25. // const props = defineProps(['title', 'file', 'width', 'height'])
  26. const pdfSrc = computed(() => withBase(props.file))
  27. </script>