Commit 26c8ac74 by 陈玉桐

test

parent 5b767dbe
......@@ -476,12 +476,16 @@ export default {
if (res.localData.substr(0, 5) != 'data:') {
// me.uploadPic = 'data:image;base64,' + res.localData
me.option.img = 'data:image/jpeg;base64,' + res.localData
// me.option.img = 'data:image/jpeg;base64,' + res.localData
let URL = me.dataURLtoBlob('data:image/jpeg;base64,' + res.localData)
me.option.img = URL.createObjectURL()
me.cropperShow = true
}else{
// me.uploadPic = res.localData // localData是图片的base64数据,可以用img标签显示
me.option.img = res.localData
// me.option.img = res.localData
let URL = me.dataURLtoBlob(res.localData)
me.option.img = URL.createObjectURL()
me.cropperShow = true
}
}
......@@ -534,8 +538,19 @@ export default {
this.guideStatus = 1
})
}
}
},
dataURLtoBlob(dataurl) {
var arr = dataurl.split(','),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new Blob([u8arr], { type: mime });
}
}
}
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment