赞
踩
- // 图片长按点击事件
- imgBoxClick() {
- console.log("长按触发");
-
- console.log("httpImgUrl", this.httpImgUrl);
-
- // 假设你有一个网络图片的链接
- let imageUrl = this.httpImgUrl;
- // 下载图片
- uni.downloadFile({
- url: imageUrl,
- success: downloadResult => {
- if (downloadResult.statusCode === 200) {
- // 下载成功,保存图片到系统相册
- uni.saveImageToPhotosAlbum({
- filePath: downloadResult.tempFilePath,
- success: () => {
- uni.showToast({
- title: '图片保存成功'
- });
- },
- fail: () => {
- uni.showToast({
- title: '图片保存失败',
- icon: 'none'
- });
- }
- });
- } else {
- uni.showToast({
- title: '图片下载失败',
- icon: 'none'
- });
- }
- },
- fail: () => {
- uni.showToast({
- title: '图片下载失败',
- icon: 'none'
- });
- }
- });
- },

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。