当前位置:网站首页>小程序预览pdf
小程序预览pdf
2022-07-29 21:13:00 【~忆缘】
1.添加jquery.qrcode.min.js和jquery-3.6.0.min.js
2.在要实现预览pdf功能的页面引入==>import Pdfh5 from ‘pdfh5’
效果
页面代码
<!-- 富文本弹出框(阅读协议) 激活质保 -->
<van-dialog
use-slot
:title="dialog.title"
:class="dialog.countdown ? 'zb' : ''"
:show="dialog.show"
:show-cancel-button="dialog.showCancelButton && !formData[dialog.extField.name]"
:confirm-button-text="
dialog.confirmText + (dialog.countdown ? '(' + dialog.countdown + 's)' : '')
"
:cancel-button-text="dialog.cancelText"
@confirm="dialogConfirm"
@cancel="dialogCancel"
>
<view style="height: 50vh; overflow-y: auto; font-size: 15px; padding: 20rpx">
<div id="pdfFileShow" style="width: auto; height: auto"></div>
</view>
</van-dialog>
//实例化pdf- js代码
return {
pdfurl:'',
pdfh5:null,
// 弹窗(如阅读协议)
dialog: {
show: false,
extField: {
// frontEndConfig:{
// confirmText:"同意",
// cancelText:"不同意",
// time:10, //至少阅读多少秒
// must:true, //是否必须同意
// title:"",
// text:"",
// content:""
// }
}
}
}
this.pdfh5 = new Pdfh5($("#pdfFileShow"),{
zoomEnable: true, //是否允许pdf手势缩放
renderType: 'svg', //pdf渲染模式 svg canvas,
data: res.data
})
//监听完成事件
this.pdfh5.on("complete",function(status,msg,time){
console.log("状态:" + status + ",信息:" +
msg + ",耗时:" + time + "毫秒,总页数:" + this.totalNum)
});
//预览同意后调用方法
dialogConfirm() {
}
//弹框取消操作
dialogCancel() {
if (this.dialog.timer) {
clearInterval(this.dialog.timer);
}
this.dialog.show = false;
}
style样式
.zb /deep/ .van-dialog__footer .van-dialog__button:last-child {
pointer-events: none;
}
边栏推荐
猜你喜欢

OneNote tutorial, how to take notes in OneNote?

Huawei Enjoy 50 Pro evaluation: HarmonyOS blessing is smoother and safer

高通WLAN框架学习(31)-- Power save

Fully automated machine learning modeling!The effect hangs the primary alchemist!

分析少年派2中的Crypto

普洛斯荣获两项“数据中心绿色等级评估”5A级认证
![LeetCode 593 Valid Squares [Math] HERODING's Road to LeetCode](/img/c2/34624c9c7693ba40d0b3724c0db611.png)
LeetCode 593 Valid Squares [Math] HERODING's Road to LeetCode

全景教程丨VR全景拍摄如何拍摄日出和日落的场景?

4. Implementation Guide for GET_ENTITYSET Method of SAP ABAP OData Service Data Provider Class

转:idea中language level设置
随机推荐
SQL教程之性能不仅仅是查询
WPF 实现抽屉菜单
网络通信编程基础,BIO,NIO
MySQL数据查询 - 简单查询
The sword refers to Offer II 097. Number of subsequences
QT安装、创建项目与调试,在VS中的使用:手把手教程
JS实现百叶窗特效
数组和List互转
人社部公布“数据库运行管理员”成新职业,OceanBase参与制定职业标准
1. Promise usage in JS, 2. The concept and usage of closures, 3. The difference between the four methods and areas of object creation, 4. How to declare a class
全景教程丨VR全景拍摄如何拍摄日出和日落的场景?
240. Searching 2D Matrix II
378. The Kth Smallest Element in an Ordered Matrix
APM电机输出逻辑(Motors类详解)
高通WLAN框架学习(31)-- Power save
基于PaddleSpeech搭建个人语音听写服务
转:idea中language level设置
leetcode-593:有效的正方形
336. 回文对
网络通信编程基础,BIO,NIO