700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 微信android打不开pdf 安卓系统下微信小程序打开pdf文件 没反应

微信android打不开pdf 安卓系统下微信小程序打开pdf文件 没反应

时间:2023-06-29 10:28:02

相关推荐

微信android打不开pdf 安卓系统下微信小程序打开pdf文件  没反应

1, 微信小程序本地使用真机测试,可以打开pdf 文件,但是上传程序后(体验版)进入体验版小程序,预览pdf 无反应

code :

wx.getSystemInfo({

success:function(res)

{

var sname= res.system.split(' ');

if(sname[0]=='iOS')

{

wx.navigateTo({

url:'../ggshu/ggshu?id=' +e.currentTarget.dataset.ggsid

});

}else if(sname[0]=='Android')

{

wx.request({

url: 'https://xxxxxxxxxxxxx:1234/api/v1/GgsInfo/GetInfo',

headers:{'Content-Type': 'application/json'},

data:{id:e.currentTarget.dataset.ggsid},

success:function(res)

{

that.setData({ ggsurl:res.data.url,});

wx.downloadFile({

url: res.data.url,

success(res) {

//保存到本地

wx.saveFile({

tempFilePath: res.tempFilePath,

success: function (res) {

const savedFilePath = res.savedFilePath;

// 打开文件

wx.openDocument({

filePath: savedFilePath,

fileType:'pdf',

showMenu:true,

success: function (res) {

// console.log('打开文档成功')

},

});

},

fail: function (err) {

// console.log('保存失败:', err)

}

});

}

})

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。