<img :onerror="errorImg" style="width:0.6rem;height:0.6rem" :src="item" @click="showimgDialog(item,'image')"
showimgDialog(item,type){
let _this = this
const createCORSRequest = (method,url)=>{
var xhr = new XMLHttpRequest();
if("withCredentials"in xhr){
xhr.open(method,url,true);
} else if(typeof XDomainRequest!="undefined"){
xhr = new XDomainRequest();
xhr.open(method,url);
} else {
xhr = null;
}
return xhr;
}
var xhr = createCORSRequest('GET',item);
xhr.onerror = function(){
MessageBox("提示", "图片加载失败");
};
xhr.onload = function(){
if (type === 'image') {
_this.imgDialogList=[ item ]
_this.imgDialog=true
}else{
_this.dialog = true
_this.videourl = item
}
};
xhr.send();
},
网友评论