uniapp下载预览文件点击无反应

uniapp中的下载文件预览文件 在本地真机测试可以使用 到手机上的app点击就无效果了 是那方面的问题
附上代码

img

该回答引用ChatGPT

参考下面代码



const imageList = ['jpg', 'jpeg', 'png', 'gif', 'bmp'];
const documentList = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'];

if (imageList.includes(suffix)) {
  uni.previewImage({
    current: 0,
    urls: [url]
  });
}
// 文档
else if (documentList.includes(suffix)) {
  console.log(url);
  uni.downloadFile({
    url: furl,
    success: res => {
      const filePath = res.tempFilePath;
      uni.openDocument({filePath: filePath, fileType: suffix});
    }
  });
}
// 其他
else {
  // do something
}


那可能是 接口 问题 或者 网络原因,你判断一下 res 是不是返回了正确的数字 。alert一下