使用pdfjs对pdf进行预览显示(H5与app)官网下载地址
如果不使用pdfjs进行转化,会出现有的手机会不显示,点击预览无反应,或者是点击变成下载
使用pdfjs转化就可以实现预览,不在出现下载或点击无反应
如果出现点击一直跳转到首页 而不是打开pdf 可以尝试去所下载的pdfjs文件中的viewer.js中把下面一段判断进行注销处理
<template>
<view>
<web-view :src="pathUrl"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
pathUrl:'',
}
},
onLoad(options) {
if(options&&options.pdfUrl){
this.pathUrl ='/static/pdfJs/web/viewer.html?file=' + encodeURIComponent(options.pdfUrl);
}
console.log(this.pathUrl);
},
methods: {
}
}
</script>
<style>
</style>