uniapp开发微信小程序保存文件方案总结

uniapp开发微信小程序保存文件方案总结

1.需求背景
  • 最近正使用uniapp开发微信小程序项目,现需要保存文件。
解决方案
  • // 方法如下,filePath:文件地址:
    
      uni.authorize({
          
          
        'scope.writePhotosAlbum',
        success() {
          
          
            uni.saveImageToPhotosAlbum({
          
          
            filePath,
            success: function() {
          
          
              Toast('保存成功')
            }
          })
        },
        fail(err) {
          
          
          Toast(err.errMsg)
        }
      })
    
    
  • 解决。

猜你喜欢

转载自blog.csdn.net/qq_34917408/article/details/129088687