测试安卓预览图片
This commit is contained in:
+5
-2
@@ -56,8 +56,11 @@ export function previewFile(id,responseType = 'arraybuffer') {
|
||||
header,
|
||||
responseType,
|
||||
success(result) {
|
||||
let _blob = new Blob([result.data],{type:result.header['content-type'].split(';')[0]})
|
||||
resolve(_blob)
|
||||
console.log(result)
|
||||
let _header = result.header['content-type'].split(';')[0]
|
||||
// let base64 = new Blob([result.data],{type:result.header['content-type'].split(';')[0]})
|
||||
let base64 = `data:${_header};base64,` + uni.arrayBufferToBase64(result.data)
|
||||
resolve(base64)
|
||||
},
|
||||
fail(error) {
|
||||
reject(new Error('Upload failed'));
|
||||
|
||||
@@ -43,12 +43,12 @@
|
||||
getPreviewUrlBlob(id) {
|
||||
// this.imgUrlShow = '@/static/images/index/message_b.png'
|
||||
previewFile(id).then((res) => {
|
||||
// this.imgUrlShow = URL.createObjectURL(res);
|
||||
const reader = new FileReader();
|
||||
reader.readAsDataURL(res)
|
||||
reader.onloadend = () => {
|
||||
this.imgUrlShow = reader.result;
|
||||
}
|
||||
this.imgUrlShow = res;
|
||||
// const reader = new FileReader();
|
||||
// reader.readAsDataURL(res)
|
||||
// reader.onloadend = () => {
|
||||
// this.imgUrlShow = reader.result;
|
||||
// }
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user