修复保存图片错误
This commit is contained in:
parent
61ef48d446
commit
5b9af90590
|
|
@ -1,8 +1,9 @@
|
||||||
export async function saveImageToPhotosAlbum(url: string) {
|
export async function saveImageToPhotosAlbum(url: string) {
|
||||||
if (!url) return uni.$u.toast('图片不存在')
|
if (!url) return uni.$u.toast('图片错误')
|
||||||
//#ifdef H5
|
//#ifdef H5
|
||||||
uni.$u.$toast('长按图片保存')
|
uni.$u.toast('长按图片保存')
|
||||||
//#endif
|
//#endif
|
||||||
|
//#ifndef H5
|
||||||
try {
|
try {
|
||||||
const res: any = await uni.downloadFile({ url, timeout: 10000 })
|
const res: any = await uni.downloadFile({ url, timeout: 10000 })
|
||||||
await uni.saveImageToPhotosAlbum({
|
await uni.saveImageToPhotosAlbum({
|
||||||
|
|
@ -15,4 +16,5 @@ export async function saveImageToPhotosAlbum(url: string) {
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
uni.$u.toast(error.errMsg || '保存失败')
|
uni.$u.toast(error.errMsg || '保存失败')
|
||||||
}
|
}
|
||||||
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue