成功
- 发布:2020-10-05 20:05
- 更新:2021-04-07 16:53
- 阅读:1669
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win 8
HBuilderX类型: 正式
HBuilderX版本号: 2.8.13
手机系统: Android
手机系统版本号: Android 8.0
手机厂商: 华为
手机机型: p10
页面类型: vue
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
应该成功
应该成功
实际结果:
未成功
未成功
bug描述:
验证码图片可以在H5 端显示。
不能再 App 端显示;
<image :src="imageData" @click="getCaptcha()" ></image>
========================================================
JS 代码:
let res = await this.$http.getRe(url_str, data, header);
this.imageData = 'data:image/jpg;base64,' + btoa(new Uint8Array(res).reduce((data, byte) => data + String.fromCharCode(byte), ''));
this.imageData = this.imageData.replace(/[\r\n]/g, "");
console.log(this.imageData);
下面的方式是可以在APP和H5端都能显示:
<image src="data:image/jpg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAyAMgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDB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oA1vA86al8PNCdvmEmnQo/uQgVv1Br5v+EkjaV8X9LhlOCJZrd/qY3UfrivqLQdEtPDuiWuk2PmfZbZSsfmNubBJPJ+prFk+GfhR9et9bh037LqMNwLkTW8jLucNuO5c7SCevHegDrxTxTRThQA4UUoooA4YU4UUUAPFOFFFADxThRRQBzHjfS9Pu9DlnubC1mmTAWSSFWZfoSM1B8OrK1t9IZ4LaGJycFkjCk/lRRQB2opwoooAeKcKKKAHCniiigBwp4oooAcKcKKKAHinCiigBwp4oooAcKeKKKAHCiiigD//Z" @click="getCaptcha()" ></image>
1***@189.cn
解决了得使用uniapp 自己的uni.request请求方法
2021-08-19 11:12