Taro.canvasToTempFilePath({ canvasId: 'myQrcode', canvas, x: 0, y: 0, width: props.width, height: props.height, destWidth: 600, destHeight: 600, success(res) { const fileManager = Taro.getFileSystemManager(); const fileData = fileManager.readFileSync(res.tempFilePath); const base64 = `data:image/jpg;base64,${Taro.arrayBufferToBase64(fileData)}`; console.error(base64); emits('getUrl', base64); console.log('二维码临时路径:', res.tempFilePath); }, fail(res) { console.error(res); }, }); 转成 base64 管他牛马蛇神都能用
image标签src为src="wxfile://*******" 无法正常显示图片?开发者工具中没问题。体验版和正式版路径都是wxfile://开头,都无法显示。 出问题代码如下: wxChooseImage({ count: 1, sizeType: ['compressed'] }).then(res => { this.setData({ eventLogo: res.tempFilePaths[0] }) }) [图片]
01-16