导读:uniapp: this.$request是自己封装的 uni.request函数,responseType也需要写入封装函数
uniapp: this.$request是自己封装的 uni.request函数,responseType也需要写入封装函数,具体见uniapp请求封装
- <template>
- <view>
- <!-- 显示图片的位置-->
- <image :src="QRImg"></image>
- </view>
- </template>
-
- <script>
- export default {
- data() {
- return {
- QRImg: '',
- }
- },
- methods: {
-
- async getImg() {
- const res = await this.$request('请求的url', {
- data: {
- "tablesid": this.orderId,
- },
- responseType: "arraybuffer",
- })
- console.log(res, "kdkdkd")
- const arrayBuffer = res.data
-
- this.QRImg = `data:image/jpeg;base64,${uni.arrayBufferToBase64(arrayBuffer)}`
- },
- }
- </script>