Created
June 3, 2020 08:51
-
-
Save mibiio/a9551357170bbe0f0b4f2e8168e46681 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<q-page padding> | |
<q-pdfviewer | |
v-model="show" | |
type="pdfjs" | |
:src="pdfUrl" | |
content-class="absolute" | |
/> | |
</q-page> | |
</template> | |
<script> | |
import { axiosInstance } from 'boot/axios' | |
export default { | |
mounted () { | |
axiosInstance.get('/api/file', | |
{ | |
responseType: 'arraybuffer' | |
} | |
).then(r => { | |
const blob = new Blob([r.data], { type: 'application/pdf' }) | |
this.pdfUrl = window.URL.createObjectURL(blob) | |
this.show = true | |
}) | |
}, | |
data () { | |
return { | |
show: false, | |
pdfUrl: null | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment