小程序 之生成海报与保存到本地
一、效果图
二、代码
<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() } } }) }