uni.canvasToTempFilePath({
canvasId: 'panel',
x: 0,
y: 0,
width: this.state.width,
height: this.state.height,
success:(res)=>{
console.log(res.tempFilePath) //此路径无法在image标签上预览
}
})
- 发布:2022-03-29 11:05
- 更新:2022-03-29 12:07
- 阅读:704
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: windows11
HBuilderX类型: 正式
HBuilderX版本号: 3.3.13
手机系统: Android
手机系统版本号: Android 11
手机厂商: 模拟器
手机机型: 模拟器
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
使用uni.canvasToTempFilePath将canvas导出图片
使用uni.canvasToTempFilePath将canvas导出图片
预期结果:
app端 uni.canvasToTempFilePath生成的tempFilePath可以预览
app端 uni.canvasToTempFilePath生成的tempFilePath可以预览
实际结果:
app端 uni.canvasToTempFilePath生成的tempFilePath不可以预览
app端 uni.canvasToTempFilePath生成的tempFilePath不可以预览
bug描述:
app端 uni.canvasToTempFilePath生成的tempFilePath "_doc/uniapp_temp_1648522782349/canvas/16485227880870.png"无法预览,前面拼接file:///也无法预览,h5平台生成的base64可以预览
拓荒 (作者)
plus.io.convertLocalFileSystemURL()用这个api转一下才可以,可能就是这样的吧
2022-03-29 13:03