1***@qq.com
1***@qq.com
  • 发布:2025-03-03 03:09
  • 更新:2025-03-03 03:09
  • 阅读:115

同样的代码编译为微信小程序保存的图片能够正常访问,编译为qq小程序保存的图片无法访问

分类:uni-app
    let base64 = this.poster.replace(/^data:image\/\w+;base64,/, "");; //图片替换  
                  let filePath = `${wx.env.USER_DATA_PATH}/${this.config.name}.png`;  

                uni.getFileSystemManager().writeFile({  
                    filePath: filePath, //创建一个临时文件名  
                    data: base64, //写入的文本或二进制数据  
                    encoding: 'base64', //写入当前文件的字符编码  
                    success: (res) => {  
                        uni.saveImageToPhotosAlbum({  
                            filePath: filePath,  
                            success: () => {  
                                uni.showToast({  
                                    title: '保存成功',  
                                    icon: "none",  
                                    duration: 5000  
                                })  
                            },  
                            fail: (err) => {  
                                console.log(err);  
                                uni.showToast({  
                                    title: '保存失败',  
                                    icon: "none",  
                                    duration: 5000  
                                })  
                            }  
                        })  
                    },  
                    fail: (err) => {  
                        console.log(err)  
                    }  
                })
2025-03-03 03:09 负责人:无 分享
已邀请:

要回复问题请先登录注册