当前位置:网站首页>小程序预览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;
}
边栏推荐
- The cornerstone of distributed: reliability - What a tangled web we weave
- OAuth,JWT ,OIDC你们搞得我好乱啊
- Use the PostgreSQL GRANT command to modify permissions on various database objects
- 全自动化机器学习建模!效果吊打初级炼丹师!
- RedisJson 横空出世!
- Liu Genghong, boys and girls, come here!Sports data analysis and mining!(with a full set of code and data sets)
- leetcode-593:有效的正方形
- 【数据库】mysql日期格式转换
- Chrome浏览器打印flash log
- 全景教程丨VR全景拍摄如何拍摄日出和日落的场景?
猜你喜欢
OneNote tutorial, how to take notes in OneNote?
【Nacos】nacos1.x 单机、内置数据库模式修改密码
WeChat Mini Program 31 Subcontracting Mechanism
华为畅享50 Pro评测:HarmonyOS加持 更流畅更安全
ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
网络通信编程基础,BIO,NIO
LeetCode 593 Valid Squares [Math] HERODING's Road to LeetCode
VSCode配置终端为系统命令行
写出优雅的Kotlin代码:聊聊我认为的 “Kotlinic“
240. Searching 2D Matrix II
随机推荐
C# 窗体与子线程数据交互
OneNote tutorial, how to take notes in OneNote?
解决报错 WARNING: IPv4 forwarding is disabled. Networking will not work.
分析少年派2中的Crypto
仿Modbus消息帧进行通信
南华早报 | 助力亚洲最具公信力报章实现AD域自动化管理
全球都热炸了,谷歌服务器已经崩掉了
【593. 有效的正方形】
分布式之基石: 可靠性——What a tangled web we weave
378. 有序矩阵中第 K 小的元素
数字孪生万物可视 | 联接现实世界与数字空间
json-c实现json和结构体之间的相互转换
PointPillars 工程复现
容器网络硬核技术内幕 (小结-中)
AI全流程开发难题破解之钥
全自动化机器学习建模!效果吊打初级炼丹师!
LeetCode 0593. 有效的正方形
惠普服务器硬盘指示灯不亮或显示蓝色
网站ping端口的操作方法和命令介绍
WPF 实现抽屉菜单