Hbuilderx+vue2+微信小程序 预览pdf

javascript 复制代码
gotoPDF(pdfName) {
	uni.showLoading({
		title: 'loading'
			});
			wx.downloadFile({
				url: `http://211.153.55.36:4426/${pdfName}.pdf`,   // 服务器上的pdf文件地址
				success: function(res) {
					const filePath = res.tempFilePath
					wx.openDocument({
						filePath: filePath,
						fileType: 'pdf',
						showMenu: true,
						success: function(res) {
							uni.hideLoading()
							console.log('打开文档成功')
						},
						fail: function(err) {
							uni.hideLoading()
							console.log('fail:' + JSON.stringify(err));
						},
					})
				}
			})				
}
相关推荐
icebreaker22 分钟前
Weapp-vite:原生模式之外,多一种 Vue SFC 选择
前端·vue.js·微信小程序
icebreaker28 分钟前
重走 Vue 长征路 Weapp-vite:编译链路与 Wevu 运行时原理拆解
前端·vue.js·微信小程序
大米饭消灭者3 天前
Taro是怎么实现一码多端的【底层原理】
微信小程序·taro
百事牛科技4 天前
保护文档安全:PDF限制功能详解与实操
windows·pdf
FliPPeDround4 天前
Vitest Environment UniApp:让 uni-app E2E 测试变得前所未有的简单
微信小程序·e2e·前端工程化
FliPPeDround4 天前
微信小程序自动化的 AI 新时代:wechat-devtools-mcp 智能方案
微信小程序·ai编程·mcp
吴声子夜歌4 天前
小程序——布局示例
小程序
码云数智-大飞4 天前
如何创建自己的小程序,码云数智与有赞平台对比
微信小程序
luffy54594 天前
微信小程序页面使用类似filter函数的wxs语法
微信小程序·小程序
Slow菜鸟4 天前
微信小程序开发(二)目录结构完全指南
微信小程序·小程序