1.引入 https://mozilla.github.io/pdf.js/getting_started/#download
2.HTML
<view class="enclosureList" @tap="preview(item.attachName,item.attachUrl)" v-for="(item,index) in info.attachList" :key="index">{
{
item.attachName}}</view>
preview(type,id){
if(type.slice(-3) =='pdf'){
uni.navigateTo({
url:'/pages/my/pdf?pdfUrl='+ id
})
console.log(id)
}else{
this.downLoadFile(id)
}
},
//下载文件
downLoadFile(id){
/*var fileUrl = this.content.enclosureUrl;
var url =decodeURIComponent(fileUrl);//对 encodeURIComponent() 函数编码的 URI 进行解码
var reg = new RegExp(":443");
url = url.replace(reg,"");*/
//下载文件,生成临时地址
uni.showLoading({
title: '下载中...',
})
uni.d