3***@qq.com
3***@qq.com
  • 发布:2019-05-30 17:22
  • 更新:2019-05-31 10:51
  • 阅读:980

我把图片存本地临时文件但是如果不清除缓存就取不到缓存的图片是怎么回事?

分类:uni-app
uni.removeStorage({  
                key: image_name,  
                success: function() {  
                    uni.getStorage({  
                        key: image_name,  
                        success: function(res) {  
                        },  
                        fail() {  
                            // 本地没有缓存 需要下载   
                            uni.downloadFile({  
                                url: image_url,  
                                success: (res) => {  
                                    // console.log(JSON.stringify(res.tempFilePath))  
                                    if (res.statusCode === 200) {  
                                        uni.setStorage({  
                                            key: image_name,  
                                            data: res,  
                                            success: function() {  

                                            }  
                                        })  
                                    }  
                                }  
                            });  
                        }  
                    });  

这样写的问题就是会卡。。。。

2019-05-30 17:22 负责人:无 分享
已邀请:
3***@qq.com

3***@qq.com (作者)

是不是跟你们是自动清理有问题?

  • DCloud_UNI_GSQ

    https://uniapp.dcloud.io/api/file/file?id=savefile

    2019-05-31 10:50

深海智行

深海智行 - 专注前端培训

你以为“临时”二字是闹着玩的?

该问题目前已经被锁定, 无法添加新回复