axios
    .get(url + '/anjiPost/queryAnjiImg', {
        params: params,
        responseType: 'arraybuffer',
    })
    .then(res => {
        // 处理返回的文件流
        const imageUrl = `data:image/png;base64,${btoa(
            new Uint8Array(res.data).reduce(
                (data, byte) => data + String.fromCharCode(byte),
                '',
            ),
        )}`
        // 此处给图片url赋值 图片src = imageUrl
    })

 

posted on 2020-08-17 18:48  去吃饭了  阅读(566)  评论(0编辑  收藏  举报