当前位置:网站首页>小程序预览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;
}
边栏推荐
- Qualcomm WLAN framework learning (31) -- Power save
- MySQL - Design game user information table
- In 2022, you still can't "low code"?Data science can also play with Low-Code!
- 针对自动识别大麦网滑块验证码,提出解决方案,并进行分析、总结
- C语言操作符详解(1)
- PointPillars 工程复现
- MySQL - 设计游戏用户信息表
- Jenkins 如何玩转接口自动化测试?
- 人社部公布“数据库运行管理员”成新职业,OceanBase参与制定职业标准
- SwiftUI Apple App Store 发布App的初学者完整指南
猜你喜欢
随机推荐
刘畊宏男孩女孩看过来!运动数据分析挖掘!(附全套代码和数据集)
Qualcomm WLAN framework learning (31) -- Power save
Huawei Enjoy 50 Pro evaluation: HarmonyOS blessing is smoother and safer
Writing Elegant Kotlin Code: Talk About What I Think "Kotlinic"
无文件落地免杀的初尝试思考(上)
TCP协议详解
.NET 6.0中使用Identity框架实现JWT身份认证与授权
阿里 P8 爆出的这份大厂面试指南,看完工资暴涨 30k!
微信小程序 30 自定义模板和获取用户登录凭证
Cobaltstrike and BurpSuite desktop shortcut configuration
【ORM框架:Sequelize的查询】
7 行代码搞崩溃 B 站,原因令人唏嘘!
SAP ABAP OData 服务 Data Provider Class 的 GET_ENTITYSET 方法实现指南试读版
【Nacos】nacos1.x 单机、内置数据库模式修改密码
初识网络的简单概念
leetcode122. Best Time to Buy and Sell Stock II 买卖股票的最佳时机 II(简单)
Come in now!!!Take you to know the basic data types of C language
关于 golang 错误处理的一些优化想法
【593. 有效的正方形】
7 行代码搞崩溃 B 站,原因令人唏嘘!









