扫一扫分享
vue 的 PDF 查看器,使用 Mozilla 的 PDF.js,支持 Vue2 和 Vue3。
安装
#For Vue 2:
npm install --save pdfvuer
#For Vue 3:
npm i pdfvuer@next --save
使用
<template>
<pdf src="./static/relativity.pdf" :page="1">
<template slot="loading">
loading content here...
</template>
</pdf>
</template>
<script>
import pdf from 'pdfvuer'
import 'pdfjs-dist/build/pdf.worker.entry' // not needed since v1.9.1
export default {
components: {
pdf
}
}
手机预览