You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tifToImg(path) {
console.log('-----------------');
// path = 'https://datacenter1-oss.oss-cn-shenzhen.aliyuncs.com/ifi_pic/EP/0016/268/EP0016268B1/zy/000001.tif'
path = '../../assets/000001.tif'
// var Tiff = require('tiff.js')
// console.log(Tiff);
// let imgBox = this.$refs.imgBox
var xhr = new XMLHttpRequest();
xhr.responseType = 'arraybuffer';
xhr.open('GET', path);
xhr.onload = (e) => {
// console.log(e);
var tiff = new Tiff({buffer: xhr.response});
var url = tiff.toDataURL()
console.log(url);
return url
// let img = document.createElement('img')
// img.src = url
// img.style.width = width + 'px'
// img.style.height = height + 'px'
// container.append(img)
};
xhr.send();
},
代码中var tiff = new Tiff({buffer: xhr.response});这句话报错如下
Uncaught TypeError: Cannot read property 'slice' of null
at r (tiff.min.js?e97c:78)
at eval (tiff.min.js?e97c:78)
at loadModule (tiff.min.js?e97c:78)
at Function.Lb.initialize (tiff.min.js?e97c:78)
at new Lb (tiff.min.js?e97c:78)
at XMLHttpRequest.xhr.onload (imgesist.vue?053e:194)
The text was updated successfully, but these errors were encountered:
tifToImg(path) {
console.log('-----------------');
// path = 'https://datacenter1-oss.oss-cn-shenzhen.aliyuncs.com/ifi_pic/EP/0016/268/EP0016268B1/zy/000001.tif'
path = '../../assets/000001.tif'
// var Tiff = require('tiff.js')
// console.log(Tiff);
// let imgBox = this.$refs.imgBox
var xhr = new XMLHttpRequest();
xhr.responseType = 'arraybuffer';
xhr.open('GET', path);
xhr.onload = (e) => {
// console.log(e);
var tiff = new Tiff({buffer: xhr.response});
var url = tiff.toDataURL()
console.log(url);
return url
// let img = document.createElement('img')
// img.src = url
// img.style.width = width + 'px'
// img.style.height = height + 'px'
// container.append(img)
};
xhr.send();
},
代码中var tiff = new Tiff({buffer: xhr.response});这句话报错如下
Uncaught TypeError: Cannot read property 'slice' of null
at r (tiff.min.js?e97c:78)
at eval (tiff.min.js?e97c:78)
at loadModule (tiff.min.js?e97c:78)
at Function.Lb.initialize (tiff.min.js?e97c:78)
at new Lb (tiff.min.js?e97c:78)
at XMLHttpRequest.xhr.onload (imgesist.vue?053e:194)
The text was updated successfully, but these errors were encountered: