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

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

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

你可能感兴趣的:(uniApp,微信小程序,uni-app)