本文共 603 字,大约阅读时间需要 2 分钟。
推荐UI框架:
iView: Mint-ui: 代码如下:// 代码是Vue形式的,自行转换getImgCodeApi:function(obj){ this.$http.get("url", { responseType: "arraybuffer", }).then(function (response) { //将从后台获取的图片流进行转换 return 'data:image/png;base64,' + btoa( new Uint8Array(response.data).reduce((data, byte) => data + String.fromCharCode(byte), '') ); }).then(function (data) { //接收转换后的Base64图片 obj.imgCodeUrl = data; }).catch(function (err) { }) },
转载地址:http://fzumf.baihongyu.com/