图片

wxml
<image src="/image/selected.png" class="img"></image>
<button class="btnclick" bindtap="btnclick">保存图片</button>
js
//本地图片下载btnclick(){wx.showShareImageMenu({path:"../image/selected.png"})},//使用网络图片
btnclick(){wx.downloadFile({url: 'https://res.wx.qq.com/wxdoc/dist/assets/img/demo.ef5c5bef.jpg',success: (res) => {console.log(res)wx.showShareImageMenu({path: res.tempFilePath,success: ()=>{},fail: (res)=> {console.log(res)if( res.errMsg.indexOf('deny')!=-1||res.errMsg.indexOf('denied')!=-1 ){wx.showToast({title: '保存相册失败,请设置权限!',icon: 'none',duration: 2000,})}else{wx.showToast({title: '保存相册失败,请重试!',icon: 'none',duration: 2000,});}}})}})},
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!