<script>
import { getPdfUrl } from '@/api/generatedApi'

export default {
  name: 'RenderFile',
  props: {
    iframeSrc: {
      type: String,
      default: () => window.location.origin
    },
    // 文件ID
    id: {
      type: String,
      default: () => ''
    }
  },
  methods: {
    getPdfUrl
  }
}
</script>

<template>
  <iframe
    id="iframe"
    frameborder="0"
    :src="
      `${iframeSrc}/pdfjs-dist/web/viewer.html?file=${encodeURIComponent(
        getPdfUrl({ documentId: id })
      )}`
    "
    class="miner-u"
    style="width: 100%; height: 800px;"
  ></iframe>
</template>

<style lang="scss" scoped></style>
