图片
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/b1872b94636961a90e96ee17b3a48843.png)
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,
});
}
}
})
}
})
},