网址:https://mozilla.github.io/pdf.js/

这两个下载那个都行(第一个是新浏览器的,第二个是旧浏览器的)

我这里放在了static文件夹下并更改文件名为pdf,其他位置都行,知道导入的时候路径写对就行

vue 3.X版本
<template>
<view >
<web-view :src="obj.u"></web-view>
</view>
</template>
<script setup>
import {onLoad} from '@dcloudio/uni-app'
import {ref,onMounted,reactive} from 'vue'
const obj = reactive({
viewerUrl: '../../static/pdf/web/viewer.html',
u:''
})
onLoad((options)=>{
//这里接收pdf地址 可以通过组件传参 options接收放在下面地址的位置就行
let url = encodeURIComponent("http://192.168.1.114:4000/1.pdf")
url = "../../static/pdf/web/viewer.html?file=" + url;
obj.u = url
})
</script>
<style>
</style>
