const arrayBuffer = new Uint8Array(res.data)
const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(res.data)

- 发布:2023-11-03 17:47
- 更新:2024-11-28 15:12
- 阅读:798
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: windows 10
HBuilderX类型: 正式
HBuilderX版本号: 3.95
手机系统: Android
手机系统版本号: Android 7.0
手机厂商: 模拟器
手机机型: R11
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
const arrayBuffer = new Uint8Array(res.data)
const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(res.data)
const arrayBuffer = new Uint8Array(res.data)
const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(res.data)
预期结果:
const arrayBuffer = new Uint8Array(res.data)
const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(res.data)
const arrayBuffer = new Uint8Array(res.data)
const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(res.data)
实际结果:
const arrayBuffer = new Uint8Array(res.data)
const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(res.data)
const arrayBuffer = new Uint8Array(res.data)
const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(res.data)
bug描述:
responseType设置为arraybuffer在安卓上无效 在H5内有效,安卓转换出来的base64是错的

