微信公开课
微信公开课小程序热门讨论关于「授权相册失效」的小程序开发问题
补充:viewclass=authorizewx:if={{isShowToast}}catchtap=hiddenAuthorizationviewclass=authorizeframeviewclass=celltitle温馨提示viewviewclass=cellcontent下载图片保存到相
展开:<viewclass=authorizewx:if={{isShowToast}}catchtap=hiddenAuthorization<viewclass=authorizeframe<viewclass=celltitle温馨提示<view<viewclass=cellcontent下载图片保存到相册,需要允许访问相册,请去授权完成访问<view<buttonopentype=openSettingtype=warnbindopensetting=handleSettingclass=btn去授权<button<view<view下载套图按钮she_download(e){consolelog(e)varthat=thisthat__wxSetting()},判断是否授权,已授权执行下载事件,未授权弹出授权弹框__wxSetting(){letthat=this检测设置中是否允许保存到相册中去wxgetSetting({success(res){consolelog(res)第一,直接调取保存,系统会自动调取授权if(!resauthSetting[scopewritePhotosAlbum]){不授权thatsetData({isShowToast:true})}else{授权that__saveImage()}}})},授权按钮handleSetting(event){letthat=this对用户的设置进行判断,如果没有授权,显示的也是“去授权”按钮;thatsetData({isShowToast:false})if(!eventdetailauthSetting[scopewritePhotosAlbum]){wxshowModal({title:温馨提示,content:若不打开授权,则无法将图片保存在相册中,showCancel:false})}else{wxshowToast({icon:success,title:授权成功,success(res){that__saveImage()}})}},下载图片跟保存到相册__saveImage(){wxshowLoading({title:下载中,});}考虑到wxauthorize点击拒绝的时候授权不在提示弹框,自写一个弹框,点击授权button没有相册授权信息这是什么原因造成的
更多有关「授权相册失效」的讨论可以前往微信公开课小程序参与互动哦!了解更多