<button data-src="地址" bindtap="previewPDF" class="record-style">pdf名稱</button>
.record-style{ margin: 0; margin-top: 15rpx; padding: 0; text-align: left; background: #f2f2f2; font-size: 26rpx; color: #169bd5;}
.record-style::after{ border: 0}
//查看pdf
previewPDF(e){
wx.downloadFile({
url: e.currentTarget.dataset.src,
success: function (res) {
var filePath = res.tempFilePath
wx.openDocument({
fileType: 'pdf', // 需要寫上文件類型才能預(yù)覽,不讓回找系統(tǒng)應(yīng)用打開,體驗(yàn)不好
filePath: filePath,
success: function (res) {
console.log('打開文檔成功!')
}
})
}
})
},
文章來源地址http://www.zghlxwxcb.cn/news/detail-683478.html
文章來源:http://www.zghlxwxcb.cn/news/detail-683478.html
到了這里,關(guān)于微信小程序pdf預(yù)覽的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!