支付宝小程序提供了my.openDocument接口,即在新页面打开文件预览的 API,根据支付宝小程序文档提示,暂时只支持预览 PDF 格式文件。
js示例代码,代码来自支付宝小程序文档:https://opendocs.alipay.com/mini/api/mwpprc
// .js
my.downloadFile({
// 示例 url,并非真实存在
url: 'http://documentExample.com/alipay.pdf',
success({ apFilePath }) {
my.hideLoading();
my.openDocument({
filePath: apFilePath,
fileType: 'pdf',
success: (res) => {
console.log('open document success')
}
})
}
})
-
如何实现小程序页面内长按识别二维码如何实现小程序页面内长按识别二维码
-
安卓中,如何不跳转外部应用打开pdf安卓中,如何不跳转外部应用打开pdf
-
微信小程序开发使用包含中文的域名出错微信小程序开发使用包含中文的域名出错
-
小程序主体和网站ICP备案主体不一致,小程序的备案可以通过吗?小程序主体和网站ICP备案主体不一致,小程序的备案可以通过吗?
-
routeDone with a webviewId x that is not the current pagerouteDone with a webviewId x that is not the current page
-
WordPress是干什么的WordPress是一款开源的CMS,也就是常说的内容管理系统,它基于PHP开发,并使用MySQL作为数据库管理系统。
暂无评论,抢个沙发...