当项目中需要在线浏览pdf文件和下载时,只需提供一个url,可以用iframe元素展现
<template>
<iframe :src="url" type="application/x-google-chrome-pdf" width="100%" height="500px"
/>
</template>
<script>
export default {
data() {
return {
url:"http://cn.createpdfonline.org/pdffiles/152(20210823112027).pdf",
}
}
}
</script>
<style>
</style>