`

var file = wx.getFileSystemManager(); Console. log('1') file.writeFile({// WriteFile requires wx.env.user_data_path + '/tmp.txt' to read and write successfully. filePath: wx.env.USER_DATA_PATH + '/poster.png', data: self.preurl.slice(22), encoding:'base64', success:async()=>{ console.log('123') const res2 = await wepy.saveImageToPhotosAlbum({ filePath: Wx.env.user_data_path + '/poster. PNG '}) web. $toast(') self.isShow = false self.$apply(); }, fail:function(e){ console.log(e) } })

‘wx.getFileSystemManager() is to get the file manager object;

AA. WriteFile is the writeFile. For detailed parameters, please click to see the official document description.

String wx.env.USER_DATA_PATH

The path to the user directory in the file system

Wx.env.user_data_path +’/test.png’ This is the file name to create a temporary file.

That. Data.scene.slice (22) data:image/ PNG; Base64 is removed. Note that base64 encoders cannot display images in SRC of image components after removing this section. reference