一、效果图

小程序 之生成海报与保存到本地

 

 二、代码

<button wx:if="{{is_authorize==false}}" open-type="openSetting" class="weui-btn mini-btn font-size16" style="margin-top: 0;background-color: #5DBF44;color: #fff;line-height:90rpx;width:100%;padding:0">保存名片海报后分享</button>
        <button wx:else bindtap="saveHaibao" class="weui-btn mini-btn font-size16" style="margin-top: 0;background-color: #5DBF44;color: #fff;line-height:90rpx;width:100%;padding:0">保存名片海报后分享</button>

 

onShow:function (){
    wx.getSetting({
      success(res){
      console.log(res)
        _this.setData({
          is_authorize: res.authSetting['scope.writePhotosAlbum']
        })
      }
    })
}

 

saveHaibao(){
    wx.saveImageToPhotosAlbum({
      filePath: _this.data.url,
      success(res){
      console.log(res)
        if (res.errMsg == 'saveImageToPhotosAlbum:ok') {
            _this.showImage()
        }
      }
    })
}

 

相关文章:

  • 2021-06-17
  • 2022-12-23
  • 2021-12-09
  • 2021-12-09
  • 2021-12-19
  • 2021-12-05
  • 2022-12-23
猜你喜欢
  • 2021-12-09
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2021-10-22
  • 2021-12-09
  • 2021-06-06
相关资源
相似解决方案