1、安装指定版本
“pdfjs-dist”: “^2.0.943”,
2、showpdf组件
<template>
<!-- pdf base64显示 -->
<div class="pdf" ref="pdf">
<div class="button">
<button @click="onPrevPage">上一页</button>
<button @click="onNextPage">下一页</button>
<span>Page: {
{
canvasNowPage}} / {
{
canvasTotalPage}}</span>
</div>
<div class="canvas" ref='canvas'>
<canvas class="canvas" id="the-canvas" ref="canvas"></canvas>
</div>
</div>
</template>
<script>
import PDFJS from 'pdfjs-dist'
export default {
data() {
return